|
How To Manage Environment Variables in Windows XP[^]
From your code, if the dll is being implicitly linked (you are not calling LoadLibrary()) then
you'll need to keep the dll in the current search path.
If using LoadLibrary you can specify the path.
To set the PATH environment variable for the current process use SetEnvironmentVariable() API.
To change for all processes it's in the registry, I think at
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment (Path variable is
semi-colon delimited series of paths).
|
|
|
|
|
Wow! Thanks, it worked! You don't know how much you have helped me.
Thanks again,
BP
|
|
|
|
|
I am using MS Visual Studio 2005 and i have a problem with message events.
***TestApp.h***
class CTestApp : public CWinApp<br />
{<br />
public:<br />
CTestApp();<br />
virtual ~CTestApp();<br />
virtual BOOL InitInstance();<br />
afx_msg LRESULT OnMsg(WPARAM wParam, LPARAM lParam);<br />
DECLARE_MESSAGE_MAP()<br />
};
***TestApp.cpp***
#include "stdafx.h"<br />
#include "TestApp.h"<br />
<br />
#define WM_MY_EVENT (WM_APP + 100)<br />
<br />
BEGIN_MESSAGE_MAP(CTestApp, CWinApp)<br />
ON_MESSAGE(WM_MY_EVENT, OnMsg)<br />
END_MESSAGE_MAP()<br />
<br />
void FileWrite(char *data)<br />
{<br />
FILE *f;<br />
errno_t err;<br />
err = fopen_s(&f, "C:\\debug.txt", "a");<br />
fprintf(f, data);<br />
fflush(f);<br />
fclose(f);<br />
}<br />
<br />
CTestApp::CTestApp()<br />
{ <br />
FileWrite("Constructed\n");<br />
}<br />
CTestApp::~CTestApp()<br />
{<br />
FileWrite("Destructed\n");<br />
}<br />
<br />
CTestApp theApp;<br />
<br />
BOOL CTestApp::InitInstance()<br />
{<br />
FileWrite("Initialized\n");<br />
return false;<br />
}
This is an error message: error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CTestApp::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'
how can i fix that?
Thank you in advance
|
|
|
|
|
Try ON_THREAD_MESSAGE in the app class.
Use ON_MESSAGE in a window class.
Mark
|
|
|
|
|
then it gives new error message
error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CTestApp::* )(WPARAM,LPARAM)' to 'void (__thiscall CWinThread::* )(WPARAM,LPARAM)'
|
|
|
|
|
Sorry about that...your function should return void, not LRESULT
|
|
|
|
|
dohh.. it is alive thank you
|
|
|
|
|
edvintas wrote: afx_msg LRESULT OnMsg(WPARAM wParam, LPARAM lParam);
Are you certain you definition of OnMsg match the declaration ?
|
|
|
|
|
now it matches
so finally changes are:
in *.cpp added
void CTestApp::OnMsg(WPARAM wParam, LPARAM lParam)<br />
{<br />
}
and in *.h
LRESULT to void and ON_MESSAGE to ON_THREAD_MESSAGE
hurahhh...
|
|
|
|
|
There is a good article here at CP covering messages. Message Management
By Joseph M. Newcomer. [^] Definaltly worth a read.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
I am trying to get the CFtpFileFind class to work. If I test against my company's ftp site, I can connect and navigate(via SetCurrentDirectoy) to the desired directory, but my call to FindFile(NULL) times out, always. Just to see what files were on there, I connected with an ftp client, and it worked fine. There is only a few files on there( < 10 ) so it isn't a timeout due to too many files.
If I change it to connect to the microsoft ftp site(ftp.microsoft.com), I have no problems, FindFile(NULL) succeeds and everything seems to work fine. Is there something that needs to be configured on the ftp server to allow this call to succeed? Any ideas yould be greatly appreciated.
|
|
|
|
|
In my application I need to handle an event on my CListCtrl icon View. Whenever the user clicks the mouse and drags it to select more than one item, the onMouse Move is not called. Really weird actually, but I need an event to handle this movement.
|
|
|
|
|
skullfire wrote: the onMouse Move is not called.
It works on my machine.
led mike
|
|
|
|
|
Are you handling the WM_MOUSEMOVE event in the correct class?
|
|
|
|
|
|
Greetings:
I need to encrypt some data in a file that is quite small, in most cases, less than 300 bytes. I just need something simple: Provide the function with a key and a block of data to encrypt and it returns with the block of data encrypted. A similar function to decrypt is needed, of course.
Can anybody suggest something? I would prefer it be a C++ thing.
Thanks in advance,
Mark
|
|
|
|
|
Jethro63 wrote: Can anybody suggest something?
Have you tried searching CP? Here is but one example.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: Have you tried searching CP?
Rhetorical question?
led mike
|
|
|
|
|
|
You can search Encrypt on www.codeguru.com
|
|
|
|
|
In VC 6 I am unable to put a breakpoint on some lines of normal looking code like
int n;
n= 0;-->here
iT says the breakpoint is not positioned on a valid line. When I step through after putting the breakpoint on some other line, it skips the lines it didnt think are valid
I rebuilt all, but no help.
thanks,
sb
|
|
|
|
|
Are you in Release config? that's a classic mistake Also, check you don't have a return above these statements in the same scope - the compiler will consider this redundant code.
Hope this helps
|
|
|
|
|
If n is not used anywhere else, it may get removed by the compiler. Yes, even in debug builds, some optimizations still take place(!).
Add code that actually deos something with it (pass it to _itot(...) for example) and see if the breakpoint works then.
The other reason is a mismatch between the code in the IDE and the application being debugged (if you can set breakpoints on blank lines, that is usually why).
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
James R. Twine wrote: Add code that actually deos something with it (pass it to _itot(...) for example) and see if the breakpoint works then.
Doesn't assigning it a value constitute "doing something with it?"
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
It should, but I know that I have seen odd things in the debugger with values that are not otherwise used. Basically, if the release compiler would optimize it out, the debug compiler just might, too.
Odd, I know. Welcome to VC++ 6.0!
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|