|
Here is another easy question for you guru's who responded to my last question within minutes
why the heck is the program I made (set up as a dialog box) ALWAYS on top... it's always the up most window and is never toppled by a newly focused window.
Is there a simple switch I'm missing that allows it to behave like every other window in the world?
lead2gold
|
|
|
|
|
read about the SetWindowPos api, especially the second parameter!
Don't try it, just do it!
|
|
|
|
|
A few questions regarding SHGetFileInfo() :
1) Is it possible to use this function to determine whether filename
is a file or a folder? When filename is a directory CFile causes an error messages to be displayed and I want directory to be shown too.
2) Is using CFile the best way to get the file info i'm looking for?
(Size, Type, Path, Accessed Date, etc...) When CFile is first instantiated it opens the file, so wouldn't this change the last accessed date to the moment of creation, thus skewing accessed date each?
SHGetFileInfo(filename, 0, &shInfo, sizeof(SHFILEINFO), SHGFI_SYSICONINDEX|SHGFI_DISPLAYNAME|SHGFI_ICON|SHGFI_SMALLICON|SHGFI_TYPENAME);
CFile myFile(filename, CFile::modeRead);
CString fSize, fTitle(myFile.GetFileTitle());
fSize.Format("%d", myFile.GetLength());
LVITEM lvi;
lvi.mask = LVIF_IMAGE|LVIF_TEXT;
lvi.iItem = GetItemCount();
lvi.iSubItem = 0;
lvi.iImage = shInfo.iIcon;
lvi.pszText = shInfo.szDisplayName;
InsertItem(&lvi);
I'm drinking triples, seeing double and acting single
|
|
|
|
|
How about CFile::IsDirectory() function?
|
|
|
|
|
Hi all,
I have created a MFC dialog based application. Now, I am creating an installer with WISE installer 4.0. This installer works on my machine where Visual C++ 6.0 and many other softwares are installed but gives the error message on client machine where only Windows 2000 Server is installed without any other software installtion. Client machine only contains Windows 2000 Server.
It gives the error that mfco42d.dll is not found in System Path.
What to do? Is there any merge module for this file so that I can include it Wise installer??
Urgent help is needed.
thanks
|
|
|
|
|
|
thanks, this will help a lot.
I am now trying to deploy the release exe of my application and test it on the client machine.
If it also fails, then i ll try to link the application statically wih MFC Dlls.
Hope this works !!!
|
|
|
|
|
I have now build a release version of my app and it is working. Can you tell me why it was not working with debug version, while i was including the proper merge modules?? Why it was not working in the presense of the required dlls??
Note: I included the merge module for mfc42d.dll in Wise installer but when I execute this installer on the client machine (having only Windows 2000 Professional) installer does not installs these debug dlls. What is the reason behind this?????????
Thanks
|
|
|
|
|
the windows operating system does not include debug versions of dll software, because they are not needed for non-developer windows users.
|
|
|
|
|
I'm not sure if I summarized what I want to do properly.
Visualize a small dialog box infront of you with 2 buttons (Button1, Button2).
I want to be able to have them both call the same function but within the function distinguish which one was pressed.
example:
OnButtonPressed()
{
if (button1) -blah;
if (button2) -blah;
return
}
I have one more tiny quick question... whats the SDK function that opens the "Browse for Folder" dialog box. i made a quick image of it, it can be seen here http://www.lead2gold.org/BrowseFFolder.jpg
lead2gold
|
|
|
|
|
1- I don't think you can distinguish the 2 buttons since the callback is anonymous, can't you have 2 callbacks that simply call a third function ?
You might do something with some other messages than ON_BN_CLICKED, but I don't know how to do it without looking into it right now.
2- the function is ShBrowseForFolder
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
Thank you! I'll try this... thanks for everyone who replied, the other answers were great too, until one said it might be a maintnance nightmare.
p.s. i didn't expect to get the answer so fast!
lead2gold
|
|
|
|
|
You can use GetFocus() to test the pressed button if your buttons are members of your Dialog like this;
OnButtonPressed()
{
CWnd* pWnd = GetFocus()
if (pWnd == m_Button1)
-blah;
else if (pWnd == m_Button2)
-blah;
return;
}
But I think it's better to let every button have its own OnButton pressed function.
SHBrowseForFolder will show the folder dialog.
Arjan.
|
|
|
|
|
Oops this won't work!
Arjan.
|
|
|
|
|
Oké here it is!
Look for ON_CONTROL_RANGE in the MSDN.
ON_CONTROL_RANGE( BN_CLICKED, ID_BUTTON1, ID_BUTTONn, OnButtonPressed )
Arjan.
|
|
|
|
|
but you still don't know which button called the callback .
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
You do!
Your OnButtonPressed function will now look like this;
void OnbuttonPressed(UINT nID)
{
}
Arjan.
|
|
|
|
|
darn !! I stand corrected ...
Thanks.
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
Imho, the ON_CONTROL_RANGE can result in a maintenance nightmare. As your software evolves, it's possible that ID_BUTTON1 and ID_BUTTONn may not be consecutive, which can cause hard-to-find bugs.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
That is right, that why I don't use it myself after it happened one time.
Arjan.
|
|
|
|
|
Hi, all
I am trying to write a little experiment program where it is supposed to copy a function (the bytecode) during runtime. But I have encountered a problem, which seems to be VC++ fault (at least in debug mode). Whenever you want a function reference, VC++ gives you a different memory location than the where actual function is located. VC++ gives you a location of a jump instruction, which jumps to the actual function. But because I want the exact functions location in memory I am experiencing a problem. I hope you understood my problem (if not please reply, so I can clarify my self). Any ideas on how to avoid the problem with getting the wrong location?
Thanks in Advance
Aidman » over and out
We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.
|
|
|
|
|
Is the function you are copying inside a DLL?
John
|
|
|
|
|
nop, a regular exe
Aidman » over and out
We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.
|
|
|
|
|
I brought this up because I know dlls use a lot of JMP instructions into the actual code. The thing is that this is perfectly legal but not what you would expect. You may have to play with the compiler settings to turn off that feature.
John
|
|
|
|
|
Not sure if this will disable it in Debug mode, but you can try turning off the "Link incrementally" option on the Linker tab of the project settings. However, it may be that in debug mode it always uses the jmp instruction, regardless of the setting, so it can link faster.
Chris Richardson Terrain Software
|
|
|
|