|
Thanks!
Do you have an example?
Thank you again!
|
|
|
|
|
Modify the header file:
afx_msg void OnDropFiles( HDROP hDropInfo );
DECLARE_MESSAGE_MAP()
And the .cpp here:
ON_WM_DROPFILES()
and here
void CDialogDlg::OnDropFiles( HDROP hDropInfo )
{
char sz[MAX_PATH];
CString szMan;
UINT nFiles=DragQueryFile(hDropInfo, 0xFFFFFFFF, NULL, 0);
for (int i=0; i<nFiles; i++)
{
DragQueryFile(hDropInfo, i, sz, MAX_PATH);
szMan+=(CString(sz)+"\n");
}
DragFinish(hDropInfo);
AfxMessageBox(szMan);
}
rechi
|
|
|
|
|
How can I prevent my application from showing in the taskbar - I mean when running in a normal window (or maximized), I don't want it to appear in the taskbar area.
|
|
|
|
|
Hello, maters please help me.
In my VC++ code, in a dll, I defined a function which looks somewhat like
void *comport_read()
{
BYTE *pData;
....
pData = new BYTE[size];
....
return pData
}
Now func() gets called from a client.
void handler()
{
BYTE *pData;
pData = (BYTE *) func();
...
delete[] pData;
}
When both the DLL and the client are of debug version, errors seem latent.
But when I create them as release verions, memory exception shows up.
The apparently same symptom can be generated such as in the following lines:
BYTE *pData = new BYTE[100];
delete[] pData;
delete[] pData;
So I suspected I could have deleted[] the same pointer to dynamically
allocate memory twice but never find any wrong. Of course the same symptom
doesn't mean the same cause.
I need at least how to tackle this sort of bugging memory problems if
not the exact sotution avaliable.
|
|
|
|
|
Do your client and the DLL make use of the same heap manager? If not, then when it comes to the delete call the manager used to delete the pointer doesn't recognise it and has big problems. Try writing a delete function in the DLL and pass the pointer back into that for the call to delete. If thast solves the problem then you have a heap clash problem.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
Thank you so much. I tried what you suggested and succeeded.
I made a separate DLL where GlobalMemAlloc() and GlobalMemFree() were defined as
void *GlobalMemAlloc(size_t bytes)
{
// AFX_STATE_...
return new BYTE[bytes];
}
void GlobalMemFree(void *p)
{
delete[] p;
}
These functions are now used throughout the entire project files and functioning well.
Could you please give answers to two more questions?
Is there a way other than in the above solution?
what are/makes the differences between debug version and release version of ::new and ::delete?
Again thank you very much.
|
|
|
|
|
Is it possible that even though my contrastPos variable always has a value in it , some error could happen that when I do a successful
resSlider = RegSetValueEx(keyHandle3, "Contrast",
0, REG_DWORD, (BYTE*)&contrastPos, sizeof(DWORD));
if(resSlider != ERROR_SUCCESS)AfxMessageBox("Contrast setting not saved");
it could go and put a blank in the registry instead of the value of contrastPos?
Appreciate your help,
ns
|
|
|
|
|
Possibly a stupid question, but is contrastPos actually a DWORD ?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Ulp! I declared it as an int contrastPos - I get it from
void CSView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
contrastPos = nPos
How do I need to modify my RegSetValueEx? The sample I saw did things with DWORDS and I havent seen anything else. I do see that if I use the retrieved value that I declared as a DWORD, as an int, things seem to work okay....
On the same lines, say I want to retrieve an int from the registry.....I am trying:
DWORD valType;
DWORD valSize = sizeof(DWORD);
RegQueryValueEx(keyHandle3, "Number of Display Windows",
0, (LPDWORD) &valType, (LPBYTE) &m_numberOfBoxesSaved,
(LPDWORD) &valSize);
where I have int m_numberOfBoxesSaved
Appreciate your help,
ns
|
|
|
|
|
Hello *.*!
I have to code a little program that determines the fan speed, the CPU temp. and the voltages on the mainboard. I searched CP for a long time but I actually didn't find anything concerning reading BIOS values!
The next task is to write some C(++) code running under Linux to do the same!
Thanks in advance,
greetings, Jan.
|
|
|
|
|
You can't do this from RING3 (user-mode) code. You need to create a device driver to get hardware access.
|
|
|
|
|
Do you know if there's a driver with api I can use?
I don't even know how to code such a hw-driver on my own!
Greetings, Jan
|
|
|
|
|
I was created Toolbar by using CToolBarCtrl. I was Implemented in MDI App.
I was implemented Enable the Toolbar once if Textbox is Selected.(ON_UPDATE_UI)How to set the disable state Even if there is no child windows in MDI App?
|
|
|
|
|
is there something like CDM_GETFOLDERPATH but in SET version?
t!
|
|
|
|
|
My visual studio is messing me about. Every time I try and switch to a different file in the IDE, the system hangs for about 8-12 seconds before switching over to it. It also sometimes happens when I go to modify the file.
I have Visual Sourcesafe running for the porject in question with the DB on our server. I don't think its a problem at that end as all the other developers in the office are not having the same problem.
Anybody got any ideas on what could be the problem?
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
VC++ 6.0 ?
This may happen if you have many breakpoints in your project.
Edit->Breakpoints->Remove All and press OK.
may solve your problem.
|
|
|
|
|
You know, I read that and I thought, No way! But I checked and there was a breakpoint problem. Somehow VS had got confused and the same breakpoint was listed about 300 times!.
I removed them all and it seems to be going much faster.
Thanks!
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
|
Excute a class as a thread
Class name: CTest
i was thinking of something like this:
AfxBeginThread(CTest, THREAD_PRIORITY_NORMAL);
but it gives the error:
error C2275: 'CTest': illegal use of this type as an expression
if i can't excute a class what does this mean:
CWinThread* AfxBeginThread( CRuntimeClass* pThreadClass, int nPriority = THREAD_PRIORITY_NORMAL, UINT nStackSize = 0, DWORD dwCreateFlags = 0, LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL );
(source: MSDN)
[]D [] []D []
|
|
|
|
|
There's two ways of using AfxBeginThread:
Either you call if for a thread procedure, declared as
UINT MyThreadProc(LPVOID lParam)
{
...
}
or you use it by providing a class derived from CWinThread as first parameter.
While the former is used as a worker thread, that means doing some stuff, the latter is usually used for gui tasks.
You should have a look at MSDN to get more information about that.
|
|
|
|
|
The class must be derived from CWinThread and must override the method
BOOL CreateThread(DWORD, UINT, LPSECURITY_ATTRIBUTES);
and when passing the runtime class of class use the macro RUNTIME_CLASS(classname)
much better, unless you really need it, use the AfxBeginThread() to execute a function and pass the class object's pointer as the function's parameter.
if you have VC++.Net then read these links in the msdn
ms-help://MS.VSCC/MS.MSDNVS/vccore/html/_core_Multithreading.3a_.Creating_Worker_Threads.htm
ms-help://MS.VSCC/MS.MSDNVS/vccore/html/_core_Multithreading.3a_.Creating_User.2d.Interface_Threads.htm
|
|
|
|
|
First of all I am a usual VisualC++ developer, the problem which I am discussing is out of my hands.
While I was developing program in Visual Studio 6.0, I got erorr within the IDE that 'CANNOT EXECUTE PROGRAM'. I am getting this ERROR in the start of BUILD, what I mean that the VisualC++ compiler doesnot look for any syntax or file inclusion error, it simply spits out 'CANNOT EXECUTE PROGRAM'.
I have done my every effort from executing the VCVAR32.BAT to installing/uninstalling the VisualC++ also the VisualStudio IDE, but I am getting this problem continously.
Please anyone have any idea, how to solve this problem related to VisualC++ 6.0 or Visual Studio 6.0
Dammy More
|
|
|
|
|
Hi,
I am looking for the ultimate book on MFC...
any ideas?
|
|
|
|
|
|
Prosise - Programming Windows with MFC
My opinions may have changed, but not the fact that I am right.
|
|
|
|