Click here to Skip to main content
15,891,253 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How export functions from an exe file? Pin
Hongjun Ge16-Sep-07 2:24
Hongjun Ge16-Sep-07 2:24 
AnswerRe: How export functions from an exe file? Pin
Eytukan15-Sep-07 17:49
Eytukan15-Sep-07 17:49 
GeneralRe: How export functions from an exe file? Pin
glitteringsound18-Mar-10 10:16
glitteringsound18-Mar-10 10:16 
JokeRe: How export functions from an exe file? Pin
Rama Krishna Vavilala20-Mar-10 7:48
Rama Krishna Vavilala20-Mar-10 7:48 
QuestionToolbar with two columns how Pin
sharp_k15-Sep-07 5:35
sharp_k15-Sep-07 5:35 
AnswerRe: Toolbar with two columns how Pin
Mark Salsbery16-Sep-07 8:27
Mark Salsbery16-Sep-07 8:27 
GeneralRe: Toolbar with two columns how Pin
sharp_k17-Sep-07 12:21
sharp_k17-Sep-07 12:21 
QuestionWinMain and argv/argc Pin
dellthinker15-Sep-07 5:29
dellthinker15-Sep-07 5:29 
Hi all, im trying to make an application that requires me to use the API WinMain() and it just so happens i need to use argv and argc. Problem is that WinMain takes 4 arguments in it and doesnt have room for argc/argv[]. So i looked up the issue and as it turns out MS didnt allow the usage for whatever reason (which really isnt important to me because i need to make it work.) So i figured if i cant put it in the calling function then make it apart of a if statement. So this is what i did.

<br />
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd){<br />
	string file2="C:\\Debug\\test.exe";<br />
<br />
	if(__argv[0] == file2){<br />
		ofstream file;<br />
		file.open("test.txt");<br />
		file << "Sponcer brought to you by - Subway! Eat Fresh! :) " << endl;<br />
		file.close();<br />
		system(buffer);<br />
		exit(1);<br />
	}<br />
	else{<br />
		Sleep(1000);<br />
		//cout << "Hello World " << endl;<br />
		exit(1);<br />
	}<br />
	return 0;<br />
}<br />


And it works. But my problem is that i dont want to have to specify the name of the program and file path etc etc. Thats what argv[0] is for. So what im trying to do is this....

Use argv within the WinMain function so that i can print out file/path info. That way i can work my way around other problems. Thanx in advance!
QuestionRe: WinMain and argv/argc Pin
David Crow15-Sep-07 11:49
David Crow15-Sep-07 11:49 
AnswerRe: WinMain and argv/argc Pin
dellthinker15-Sep-07 13:32
dellthinker15-Sep-07 13:32 
GeneralRe: WinMain and argv/argc Pin
David Crow15-Sep-07 17:27
David Crow15-Sep-07 17:27 
AnswerRe: WinMain and argv/argc Pin
carrivick15-Sep-07 21:00
carrivick15-Sep-07 21:00 
Questionashen character Pin
youbo15-Sep-07 3:33
youbo15-Sep-07 3:33 
AnswerRe: ashen character Pin
Chris Losinger15-Sep-07 4:37
professionalChris Losinger15-Sep-07 4:37 
QuestionRe: ashen character Pin
David Crow15-Sep-07 11:50
David Crow15-Sep-07 11:50 
AnswerRe: ashen character Pin
youbo15-Sep-07 14:59
youbo15-Sep-07 14:59 
GeneralRe: ashen character Pin
David Crow15-Sep-07 17:18
David Crow15-Sep-07 17:18 
GeneralRe: ashen character Pin
Russell'16-Sep-07 0:22
Russell'16-Sep-07 0:22 
QuestionProblem in RegQueryValue. Pin
GauranG Shah15-Sep-07 2:07
GauranG Shah15-Sep-07 2:07 
AnswerRe: Problem in RegQueryValue. Pin
carrivick15-Sep-07 2:25
carrivick15-Sep-07 2:25 
AnswerRe: Problem in RegQueryValue. Pin
Mark Salsbery15-Sep-07 5:35
Mark Salsbery15-Sep-07 5:35 
QuestionStl::map Link Error Pin
Vinod CS15-Sep-07 0:27
Vinod CS15-Sep-07 0:27 
AnswerRe: Stl::map Link Error Pin
Chris Losinger15-Sep-07 4:34
professionalChris Losinger15-Sep-07 4:34 
QuestionProblem with Combo Box Pin
GauranG Shah14-Sep-07 23:27
GauranG Shah14-Sep-07 23:27 
AnswerRe: Problem with Combo Box Pin
Hamid_RT15-Sep-07 0:32
Hamid_RT15-Sep-07 0:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.