| | |
Having trouble calling certain functions
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jul 2005
Posts: 6
Reputation:
Solved Threads: 0
Im making this program. But im having trouble calling certain functions. Im having trouble calling ShellExecute, RemoveDirectory, CreateDirectory, FindFirstFile, & DeleteFile.
I get the following errors when trying to compile...
I never had this problen when working with DevC++. But ever since I moved to Microsoft Visual C++ 2005, I cant compile this program. Im calling the functions correctly. For example with the ShellExecute function
But it still gives me an error.
Please Help! Thanks in advance.
I get the following errors when trying to compile...
C++ Syntax (Toggle Plain Text)
c:\documents and settings\george\my documents\visual studio 2005\projects\mmpc v1.0\mmpc v1.0\prog.cpp(42) : error C2664: 'ShellExecuteW' : cannot convert parameter 2 from 'const char [5]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\george\my documents\visual studio 2005\projects\mmpc v1.0\mmpc v1.0\prog.cpp(116) : error C2664: 'ShellExecuteW' : cannot convert parameter 2 from 'const char [5]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\george\my documents\visual studio 2005\projects\mmpc v1.0\mmpc v1.0\prog.cpp(168) : error C2664: 'CreateDirectoryW' : cannot convert parameter 1 from 'const char [8]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\george\my documents\visual studio 2005\projects\mmpc v1.0\mmpc v1.0\prog.cpp(214) : error C2664: 'FindFirstFileW' : cannot convert parameter 1 from 'const char [13]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\documents and settings\george\my documents\visual studio 2005\projects\mmpc v1.0\mmpc v1.0\prog.cpp(226) : error C2664: 'DeleteFileW' : cannot convert parameter 1 from 'const char [14]' to 'LPCWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
I never had this problen when working with DevC++. But ever since I moved to Microsoft Visual C++ 2005, I cant compile this program. Im calling the functions correctly. For example with the ShellExecute function
C++ Syntax (Toggle Plain Text)
ShellExecute(0, "open", "MMPC.html", 0, 0, SW_SHOWNORMAL)
But it still gives me an error.
Please Help! Thanks in advance.
C++ Syntax (Toggle Plain Text)
ShellExecute(0, "open", TEXT("MMPC.html"), 0, 0, SW_SHOWNORMAL)
C++ Syntax (Toggle Plain Text)
ShellExecute(0, "open", L"MMPC.html", 0, 0, SW_SHOWNORMAL)
I'm here to prove you wrong.
C++ Syntax (Toggle Plain Text)
#include <windows.h> int main() { .... }
Not familiar with the IDE, but on the command line
c:\> cl /EHs prog.cpp /link shell32.lib
•
•
•
•
First off, your response has nothing to do with the OP's problem.
•
•
•
•
Secondly, don't resurrect two year old threads unless you have something amazingly earthshaking to contribute.
I'm a newb here. And don't exactly appreciate the 'cold' welcome on my first post.
But I do appreciate the fine article on the site about the fellow who enjoyed the forum because of the friendliness of the people on the forum.
Hank
I'm sorry you took my response that way, but you are the one being arrogantly rude.
Since you are new to the forum you might want to take some time to read the Forum Announcements.
Those of us who like to take the time to help people here don't like it when some newbie shows up and in his second post starts doing things universally considered obnoxious. Please take the kind hint.
Had Narue or WaltP or Salem or someone else like them (who are all very knowledgeable and very helpful) responded, you might have gotten a much less friendly response --as they have dealt with a lot more snot than I have, and have a much lower tolerance for it.
If you plan to behave and be nice, welcome. Remember, words online are easily misinterpreted whereas in direct conversation they wouldn't be. Don't assume the worst.
Also, don't assume the OP and Narue are blindingly stupid. They were both well beyond including <windows.h> and linking errors. The question was answered.
I give you this by way of welcome and advice. Take it as you will.
Since you are new to the forum you might want to take some time to read the Forum Announcements.
Those of us who like to take the time to help people here don't like it when some newbie shows up and in his second post starts doing things universally considered obnoxious. Please take the kind hint.
Had Narue or WaltP or Salem or someone else like them (who are all very knowledgeable and very helpful) responded, you might have gotten a much less friendly response --as they have dealt with a lot more snot than I have, and have a much lower tolerance for it.
If you plan to behave and be nice, welcome. Remember, words online are easily misinterpreted whereas in direct conversation they wouldn't be. Don't assume the worst.
Also, don't assume the OP and Narue are blindingly stupid. They were both well beyond including <windows.h> and linking errors. The question was answered.
I give you this by way of welcome and advice. Take it as you will.
![]() |
Similar Threads
- Please help, im new at this :/ (C)
- calling python functions from cpp functions. (Python)
- __declspec(dllexport) calling exported functions (C++)
- problems with pointers (C++)
- why calling conventions (C)
- Statistical functions in C++/Excel (C++)
Other Threads in the C++ Forum
- Previous Thread: Multiple definitions of pointers to structs
- Next Thread: Magic Square - Error Message
| Thread Tools | Search this Thread |
api array arrays based binary c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news number numbertoword output parameter pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






