|
About 3 minutes after submitting my question I found the _getPID() function. DOH!!!!, but thanks for your effort Mike
|
|
|
|
|
Does anyone knows a good tutorial on zooming functions (or how it works) in a CView class?
Thanks,
Ruben
|
|
|
|
|
See SetViewportOrg and SetWindowOrg in the online doc.
|
|
|
|
|
Hello,
I have a solution under VS.net with a dll project and an app project. THe app project uses the dll.
My current way of getting the app to compile is going into project setting for the linking and directing it to the .lib created with the .dll. I then copy the dll from the dll/debug directory to the app/debug directory in order to run the app.
Is there a better way? I could force the dll to be created int the app/debug directory but I want to be sure I am not missing some useful functionality that MS provides in this tool.
Thanks in advance.
KS
|
|
|
|
|
Add 'post build' event handling in the DLL project. Open the properties page for the DLL project and select build events. Select the post-build item. Enter the command line (or lines) you want.
Software Zen: delete this;
|
|
|
|
|
I have a win32 application that I create two Thread in it alternatively.It mean first I create the Thread No.1 and when it reached to the end of thread function I create second thread for anothre functuin and when second one reach to end,at the end of it I create first thread again. I want to know if one thread reach to end does it free its memory automaticly or my algoritm caused to any memory leak or anything else?
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
That depends on how the memory was allocated. When a thread exits, its stack is destroyed and reclaimed, but any memory allocated on the heap (such as with new ) remains allocated since that memory belongs to the process, not the thread.
--Mike--
Mister Sparkle is disrespectful to dirt.
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"You have Erica on the brain" - Jon Sagara to me
|
|
|
|
|
hmmmm,thanks.
Michael Dunn wrote:
any memory allocated on the heap (such as with new) r
What about something like char *?
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
Mazdak wrote:
What about something like char *?
If you do something like :-
char* p = new char[100];
in your thread, then you need to delete it manually when the thread exits, else it will remain in memory till the process exits (basically a leak as you lose the pointer value)
Nish
"I'm a bit bored at the moment so I'm thinking about writing a new programming language" - Colin Davies
My book :- Summer Love and Some more Cricket [New Win]
Review by Shog9 Click here for review[NW]
|
|
|
|
|
hmmm,got it. Thanks you both.
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
I got a question for you... My worker thread starts when my app starts. Reads a file parses it out.. downloads needed information.. and organizes some of the information in CArrays.
But when it is finished all of the information in the CArrays is gone.. the CArrays are member varibles and written (while locked, and prompty unlocked after writing), and I'm even able to confirm that they are writen to.
I try to even look at their size (after the thread is finished) and both report 0. (Not what it was when the thread was running, and nothing was called to remove it all).
-Steven "the yellow dart" Hicks
CPACodeProjectAddict
|
|
|
|
|
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
Ok there are 2 blank Member variable/global CArrays at the start of the program.
When the program starts it starts another thread that reads a file and looks in the file for specific information. When it finds it, it places it in the CArray as a new entry.
But after the thread ends the CArrays are blank. Although during the thread I'm able to loop through all the contents and display it.
-Steven
-Steven "the yellow dart" Hicks
CPACodeProjectAddict
|
|
|
|
|
Nevermind I fixed it with a global class variable.
-Steven "the yellow dart" Hicks
CPACodeProjectAddict
|
|
|
|
|
Hiya I really need to know how to do this. I have to be able to pass parameters between 2 single document based apps...The parameter I need to pass is a string.
What is the best way to be able to do this??
If I was doing a c++ program, I would use the argv and argc in main().
Thanks,
grahamoj.
|
|
|
|
|
The command line params are readable in several ways. The easiest for you would probably be __argc and __argv , which are set up by the C library.
--Mike--
Mister Sparkle is disrespectful to dirt.
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"You have Erica on the brain" - Jon Sagara to me
|
|
|
|
|
You can use WM_COPYDATA for that purpose. Alternatively, take a look at all the "inter-process communication" articles on this site
To get the application parameters you can use GetCommandLine() .
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
If you already have a scheme in mind that would work using argv & argc you can do the same thing with a windows application by calling GetCommandLine(). Call it from your OnInit or other initialization function it will give back the appname, path and the command line arguments as a string. Then just parse the string to get the arguments. Have fun....
|
|
|
|
|
I use the following code in two apps I wrote, app1 run first and call app2 with parameters. I don´t know if there is a better way but it worked fine.
In APP1 the caller app:
char arg[10];//parameter to pass from app1 to app2
fflush(NULL);
//call app2.exe and leaves app1 waiting.
_spawnl(P_WAIT,"app2.exe","app2.exe",arg,NULL);
//call app2.exe and ends app1.
//_execl( "EcoBase.exe", NULL, NULL,NULL, NULL );
In InitInstance() of the called app2:
//check if there are paremeters
if(m_lpCmdLine[0]==_T('\0'))
{
//normal execution of app2 without parameters
if(!ProcessShellCommand(cmdInfo))
return FALSE;
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow();
return TRUE;
}
else//execution of app2 with parameters
{
cmdInfo.m_nShellCommand=CCommandLineInfo::FileNew;
if (!ProcessShellCommand(cmdInfo))
return FALSE;
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow();
return TRUE;
//do what you want to do with parameters in m_lpComdLine
}
cheers!!
Daniel Cespedes Daza
"Santa Cruz de la Sierra Paraiso Terrenal!"
daniel.cespedes@ieee.org
|
|
|
|
|
Many different possibilities: mappedFiles, mailslots, sockets, WM_COPYDATA. If the data is fixed, you can use SendMessage/SendMessageTimeout with registered message, etc, etc, etc
|
|
|
|
|
Thanks for that. What I have decided to do is this:
// in app1
PROCESS_INFORMATION ProcessInfo;
STARTUPINFO StartupInfo;
ZeroMemory( &StartupInfo,sizeof(StartupInfo) );
StartupInfo.cb = sizeof( StartupInfo );
if( CreateProcess("d:\\MyApp1.exe","TestString",
NULL,NULL,FALSE,0,NULL,
NULL,&StartupInfo,&ProcessInfo ))
{
WaitForSingleObject( ProcessInfo.hProcess,INFINITE );
CloseHandle( ProcessInfo.hThread );
CloseHandle( ProcessInfo.hProcess );
}
else
{
cout << "Error - Opening Process..";
}
The second parameter is the command line argument. So now I can use GetCommandLine() function.
But I can't get GetCommandLine to work for me. Can someone show me please how to use this function??
Thanks for all ur help.
|
|
|
|
|
I have now got GetCommandLine() function but I can't see my messagebox in the second app..
// in app2
CString str = GetCommandLine();
AfxMessageBox( str );
Thanks..
|
|
|
|
|
I want to connect to my mail server and get mails with Windows Sockets. I want to how can I connect to mail my server with its name ,not with its IP,because I don't know it IP.Any Suggestion?
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
|
OK Nish. Thanks.
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|