|
Once again this blasted IDE has brought this neophyte to his knees. My question is: how do you set the system path in Visual Studio 2003. I have been toiling away for the better part of 3 hours to try and get it to see the DLL that's on my hard drive, but it can't see it. Truthfully, I feel like crying.
Alas, any help you can give me would be greatly appreciated - as always.
Peace,
BP
|
|
|
|
|
Here's the search order for DLLs, from the platform SDK
The directory from which the application loaded.
The current directory.
The system directory. Use the GetSystemDirectory function to get the path of this directory.
The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.
Windows Me/98/95: This directory does not exist.
The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
The directories that are listed in the PATH environment variable.
|
|
|
|
|
How do I tell it which directory to look in? How do I add another directory to the PATH environment variable? I can't find where to set it.
Thanks,
BP
|
|
|
|
|
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
|
|
|
|