|
I don't think so, because I ant to check if I'm closing the main window, while other windows are still open. If I close the main view over a document, every other associated view must be closed.
|
|
|
|
|
When you say main window or view do you mean the whole application or just the active view in the application? I guess im not sure we are talking about the same thing.
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Handle CMainframe::ID_FILE_CLOSE.
|
|
|
|
|
Override CDocument::CanCloseFrame() and return TRUE/FALSE if it's ok/not ok to close the frame window.
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"Which comes first, the bug or the stress?" -- Chris Maunder
|
|
|
|
|
Hi,
I using CListCtrl (VC++6.0) for a list of information, I do not have any problem to use the Mouse (or Right Click) to get information of a specific row ... by using:
<br />
int sel = m_browseW.GetNextItem (-1, LVNI_SELECTED);<br />
*) But when I use the Up/Down Keyboard (the 'highlite row' shift Up/DOWN) then I do not know which command I can try to read the new 'specific row'
Anyone can help?
Many thanks
|
|
|
|
|
Loop through the list and check the state of each row:
for (int iItem = 0, nItemCount = m_browseW.GetItemCount(); iItem < nItemCount; iItem++)
{
if (m_browseW.GetItemState(iItem, LVIS_SELECTED) & LVIS_SELECTED)
{
}
}
Regards,
Alvaro
That which does not kill me postpones the inevitable. -- despair.com
|
|
|
|
|
Hi,
I will try immediately!
Many thanks,
|
|
|
|
|
Hi,All
The following code giving me an error while running in Release Mode.
I tested this code under
Windows2000 professional,VC++6.0.
CMyDlg::OnButton()
{
BYTE byByteCmd;
CString strTemp;
char szVal[10];
szVal[0]='\0';
sprintf(szVal,"%d",1);
sscanf(szVal,"%X",&byByteCmd);
}
can any one tell me what is wrong with this code.
My observations:
1.If i commented CString strTemp---It is not giving any error
2.If this code running under Debug Mode--it is not giving any error
3.If this code running under Release Mode with TRy CATCH--it is not giving any error
TRY
{
BYTE byByteCmd;
CString strTemp;
char szVal[10];
szVal[0]='\0';
sprintf(szVal,"%d",1);
sscanf(szVal,"%X",&byByteCmd);
}
CATCH(CExPetion,expGen)
{
char szError[100];
exGen->GetErrorMessage(szError,100);
exGen->Delete();
}
END_CATCH
I am happiest man,If some one explain me step by step with this observations, why it is giving error in some conditions and not in another conditoions.
Thank in Advance
anju
|
|
|
|
|
try the following:
anju wrote:
char szVal[20];
|
|
|
|
|
Hi Alexo,
There is nothing in it r u Missed?
anju
|
|
|
|
|
Instead of sscanf(szVal,"%X",&byByteCmd); why not use atol() ?
What I think your code is doing is that you are reading an int value (%X) into a BYTE variable and overwriting the next location(s) in memory
you could try using %c
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
|
|
|
|
|
BYTE byByteCmd;
....
sscanf(szVal,"%X",&byByteCmd);
And types %X and %x require int or int alike (DWORD) argument, you are using byte.
1 byte vs 4 bytes... Due to debug mode padding you don't get an error.
|
|
|
|
|
Hi,
Thanks your comments.
but,what is the relation between " CString strTemp and sscanf(...)".
If i didn't used CString object this code doesn't give me an error.
regrads
anju
anju
|
|
|
|
|
Now this must be an old problem:
I have very big project that was originally meant solely for Linux.
I now port it also to windows (on the VC++ .NET) and apparently some DLLs call each other.
So, I face a linking problem as no .lib is available (the chicken and the egg problem).
Now this is a huge project. My options, as I see them are:
1) Take off all calls to imported functions inside some DLL, build it, build all rest the same way, then start bringing in the missing calls.
2) Use some sort of dummy lib. The problem is that if such an option really exist- I don't know how to do that.
3) Collide all DLLs into one.
I'll be glad to know if option 2 really exists, or of any other option if you see such.
Dynamically loading the DLL is as bad as option 1 as it requires many changes (each DLL exports hundreds of symbols), so I prefer to stick to the implicit load, and make as little source changes as possible.
Thanx for any help.
Elad.
|
|
|
|
|
Second option does exist - do not create complicated situations .
Is there any chance of isolating dependant functions into 3rd library?
|
|
|
|
|
Not really, this whole project is one big criss-cross...
If option 2 doesn't exist I tend to throw all code in just one big DLL...
|
|
|
|
|
How about 4th option screw static linking, and load dll(s) manually.
Or even have executable static linking DLL A, and dynamic DLL B. ( I hate static linking).
Brian
|
|
|
|
|
hey guys,
I am trying to retrieve the password of a specific user with the NetUserGetInfo function. But the MSDN says the following regarding the function:
--------------------
from msdn:
link: http://msdn.microsoft.com/library/d..._info_4_str.asp
The NetUserEnum and NetUserGetInfo functions return a NULL pointer to maintain password security.
--------------------
my code:
<br />
USES_CONVERSION;<br />
<br />
wchar_t *pswzUser = T2W("A");<br />
DWORD dwLevel = 4;<br />
USER_INFO_3 pUi;<br />
<br />
nStatus = NetUserGetInfo(NULL, pswzUser, dwLevel, (LPBYTE*)&pUi);<br />
return W2T(pUi.usri3_password);<br />
So how can I retrieve the password ???
da sonu
|
|
|
|
|
My application uses a tray icon, which can open a dialog only if asked by the user.
The rest of the time my dialog in the minimized state.
How can I remove the window from the task bar while my dialog is in minimized state so the user will only see the tray icon?
And how can I remove the menu that appears with the right click on the dialog’s icon (left top corner)?
|
|
|
|
|
To remove the button from task bar you can simply hide your window by calling ShowWindow(SW_HIDE); .
|
|
|
|
|
Hi all,
I am encountering an error, while getting the value from a Combo Box. I do want to find which value the user selects from the Combo box, if not then I want to select the default value, sure the value is not selected, I am using CComboBox.GetCurSel()
Is there any way to find out which value is on top of list in the ComboBox.
Waiting for reply;
Phantom
|
|
|
|
|
To get the current selection index, use CComboBox.GetCurSel()
To get the current string selected, use CComboBox.GetLBText(index,str) with
void GetLBText( int nIndex, CString& rString ) const;
To select the first item (the one by default), use CComboBox.SetCurSel(0);
~RaGE();
|
|
|
|
|
For various annoying reasons I need to write my own installation program. This means I potentially need to install files such as mfc42.dll. If an older verison exists it will almost certainally be in use, so I won't ( ) be able to use CopyFile or CopyFileEx.
How do programs such a InstallShield copy the locked files at the next bootup when you see something along the lines of the "Please wait etc" text?
I've had a look at the RunOnce registry entiries but I'm not sure if this is what I want.
Thanks
I feel like I'm diagonally parked in a parallel universe
Jeremy Davis
http://www.astad.org http://www.jvf.co.uk
|
|
|
|
|
|
Dominik Reichl wrote:
Q228930 - How to Replace Currently Locked Files with Inuse.exe
http://support.microsoft.com/support/kb/articles/q228/9/30.asp[^]
This works on NT and Win2k.
This looks interesting thanks, the only trouble is, I need full 95, 98, and ME compatability aswell. Hmmm, I'll see if it works.....
[Edit]small>Dominik Reichl wrote:
Deleting Locked Files
http://www.codeguru.com/files/ForceDel.shtml[^]
It's about deleting locked files, but the article explains how to unlock locked files. You unlock the files and replace with your own.
While this may work perfectly well, I'd like to find the method installshield uses. Also judging from the comments, this may not work 100% of the time. Ahh well.
Thanks
I feel like I'm diagonally parked in a parallel universe
Jeremy Davis
http://www.astad.org http://www.jvf.co.uk
|
|
|
|