Click here to Skip to main content
15,920,383 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Weird Errors? Pin
Raphael Kindt17-Sep-02 0:52
Raphael Kindt17-Sep-02 0:52 
GeneralSocket programming Pin
xai16-Sep-02 12:44
xai16-Sep-02 12:44 
GeneralRe: Socket programming Pin
xai16-Sep-02 13:02
xai16-Sep-02 13:02 
GeneralRe: Socket programming Pin
PJ Arends16-Sep-02 13:36
professionalPJ Arends16-Sep-02 13:36 
GeneralRe: Socket programming Pin
xai16-Sep-02 13:54
xai16-Sep-02 13:54 
GeneralRe: Socket programming Pin
PJ Arends16-Sep-02 14:15
professionalPJ Arends16-Sep-02 14:15 
GeneralRe: Socket programming Pin
xai16-Sep-02 14:23
xai16-Sep-02 14:23 
QuestionHow to give arguments to Win32 application Pin
rsasalm_16-Sep-02 10:31
rsasalm_16-Sep-02 10:31 
Hi all,

I have two question regarding win programming.

I have a simple application.

***********************
char str[10];

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{

switch(msg)
{
case WM_LBUTTONDOWN:
sprintf(str, "arg1 = %d, arg2 = %d" , argv[1], argv[2]);
MessageBox(NULL, "Hello", str, __FILE__, MB_OK);
break;
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASSEX wc;
HWND hwnd;
MSG Msg;

wc.cbSize = sizeof(WNDCLASSEX);
wc.style = 0;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = NULL;
wc.lpszClassName = g_szClassName;
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);

if(!RegisterClassEx(&wc))
{
MessageBox(NULL, "Window Registration Failed!", "Error!",
MB_ICONEXCLAMATION | MB_OK);
return 0;
}

hwnd = CreateWindowEx(
0,
g_szClassName,
"theForger's Tutorial Application",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 480, 320,
NULL, NULL, hInstance, NULL);

if(hwnd == NULL)
{
MessageBox(NULL, "Window Creation Failed!", "Error!",
MB_ICONEXCLAMATION | MB_OK);
return 0;
}

ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);

while(GetMessage(&Msg, NULL, 0, 0) > 0)
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return Msg.wParam;
}
*****************************************

First question is:
How to give argv[1] argv[2] etc arguments to win app as one can give to console application.

What I want is when left button is clicked the argument given to the program should appear in a dialog box.
Better if you send me a simple code example.

My second question:
I am using Visual Studio C++ 6.0.
Say, the above app is Test.exe and I want to run this application a number of times with different arguments though Visual studio IDE and not through a batch file on dose command.
Now my question is, is there any way I can write a script in VS C++, like a bat file in dose and if so how?
Script file may look like:

Test.exe 2 3
Test.exe 4 5
Test.exe 6 7
Test.exe 8 9
Test.exe 10 11
............
...........

thanks in advance
regards
/rsasalm
AnswerRe: How to give arguments to Win32 application Pin
Michael Dunn16-Sep-02 11:18
sitebuilderMichael Dunn16-Sep-02 11:18 
AnswerRe: How to give arguments to Win32 application Pin
PJ Arends16-Sep-02 12:45
professionalPJ Arends16-Sep-02 12:45 
GeneralRe: How to give arguments to Win32 application Pin
rsasalm_16-Sep-02 23:48
rsasalm_16-Sep-02 23:48 
Generaltrying to find old post about EN_CHANGE Pin
ns16-Sep-02 8:59
ns16-Sep-02 8:59 
GeneralRe: trying to find old post about EN_CHANGE Pin
jmkhael16-Sep-02 9:01
jmkhael16-Sep-02 9:01 
GeneralRe: trying to find old post about EN_CHANGE Pin
ns16-Sep-02 9:05
ns16-Sep-02 9:05 
GeneralRe: trying to find old post about EN_CHANGE Pin
Joaquín M López Muñoz16-Sep-02 9:08
Joaquín M López Muñoz16-Sep-02 9:08 
GeneralRe: trying to find old post about EN_CHANGE Pin
Roger Allen17-Sep-02 2:37
Roger Allen17-Sep-02 2:37 
GeneralRe: trying to find old post about EN_CHANGE Pin
ns17-Sep-02 2:54
ns17-Sep-02 2:54 
Generalcant figure out the simple logic!!! Pin
ns16-Sep-02 8:35
ns16-Sep-02 8:35 
GeneralRe: cant figure out the simple logic!!! Pin
jmkhael16-Sep-02 8:52
jmkhael16-Sep-02 8:52 
GeneralRe: cant figure out the simple logic!!! Pin
ns16-Sep-02 9:04
ns16-Sep-02 9:04 
GeneralRe: cant figure out the simple logic!!! Pin
Joaquín M López Muñoz16-Sep-02 9:04
Joaquín M López Muñoz16-Sep-02 9:04 
GeneralRe: cant figure out the simple logic!!! Pin
Pavel Klocek16-Sep-02 8:55
Pavel Klocek16-Sep-02 8:55 
GeneralRe: cant figure out the simple logic!!! Pin
Joaquín M López Muñoz16-Sep-02 9:03
Joaquín M López Muñoz16-Sep-02 9:03 
GeneralRe: cant figure out the simple logic!!! Pin
Bill Wilson16-Sep-02 11:10
Bill Wilson16-Sep-02 11:10 
QuestionHow do I change cursors? Pin
Nitron16-Sep-02 8:10
Nitron16-Sep-02 8:10 

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.