|
Click Retry when you get the assert-failed message box to drop into the debugger.
--Mike--
http://home.inreach.com/mdunn/
While I can't be correct on all matters, I can make the reassuring claim that where I am inaccurate, I am at least definitively inaccurate.
your with and
Sonork - 100.10414 AcidHelm
|
|
|
|
|
It has arrived to me a short time ago. The program crashed at the return of a function. I only checked the "link incrementaly" option in debug mode. If it works in release mode...your code is probably not the probleme.
|
|
|
|
|
In the registry is in HKEY_CURRENT_USER/Network
path, where some(!) network drive UNC paths can
be found. Now I wonder where are the rest???
I am trying to make a program that will show the
paths. I have tried it on several computers, and
I have found that not all the network drives are
listed in the registry.
How could I read the UNC path for ALL network drives?
API functions for that??
|
|
|
|
|
Marko wrote:
API functions for that??
Maybe NetUseEnum is what you're after...
The NetUseEnum function lists all current connections between the local computer and resources on remote servers.
|
|
|
|
|
Thanks, you showed me the right way.
I started searching information about NetUseEnum and ended up with WNetGetConnection, which does the trick.
|
|
|
|
|
Hello MFC gurus. I'm looking for some link/source on documentation on how to create/implement application that uses plugins. The only solution that I came up to is making external plugins - by limiting the functions in the dll, and I think that this isn't the way that the plugins should work. If I want external dll - I could simply write a program that does the specified functions. My point is that I want my dll to be the part that does everything but it should get/do/set data inside my main program. It's something like the winamp's general purpose dll's or like the way BO2K is done, but I can't figure out how to implement a plugin technique in my application. Any
help/link/source/book suggestions are welcome.
Greetings,
Deian
|
|
|
|
|
Hello,
I am creating an application that utilizes CryptoAPI and concerned whether it is possible to hack and extract my DES/RSA keys [which are hard coded in my app. and imported into CryptoAPI using CryptImportKey()] from it using one of the following methods:
(1) replacing the CryptoAPI dll (advapi32.dll) with some dll that will be loaded between the CryptoAPI dll and the executable. This dll will store the keys in some db and then forward the call to the CryptoAPI dll. The user might not even be aware that this is happening.
(2) Since the CryptoAPI methods are exported by name and their addresses are known - it is possible to run the application under a debugger, put a breakpoint in memory in the function CrypyImportKey() and using assmebler knowledge track down the location in memory of the passed parameters and reveal the key.
Anybody got any knowledge whether any of these is possible?
Thanks a lot!
|
|
|
|
|
I think that you may be confusing the key with the password.
Lets say a hacker virus got onto your compuetr, then it managed to fool your anti-virus into thinking that changing a system dll is ok. Then the hacker finds and passes the key to himself. This part of cause is possible, so I'm not saying it can't be done somehow. We have to assume that not all software users are as aware as us here of how important security on a PC is.
Anyway, all he has then is the key, not the password.
If you were using this program for, say, a secure site, then you would pass the key to your users, depending on your security system it could be
. once only
. on a per day basis
. per log in is not a good one for public traffic because a hacker only has to keep pounding you with login attempts to get a pattern to your security, which is something that I read recently. The hole is this case was blocked. (I refuse to say it was on a Linux site, cos I have mates on there).
. and others
The key is used on the local machine with the users password to create a, erm, dam dam, I've forgotten the proper word for it, lets call it a ReturnValue (I'm sure I'll remember the word in a minute).
From then on, its that ReturnValue that is used to log in the user and identify his traffic (if you intend to go that far, which is wise since if it needs secure users it also needs secure messaging in my book).
The imaginary hacker who stole the key has to still know or hack the password, plus has to work out which of the algorithms you used. He has to be carefull incase your key is date/time related so must keep his computer within a timeframe.
I'm not saying hacking Crypt's can't be done, but unless too much info is given to potential hackers, its a long time consuming process.
What is that word for the returned value? its in my head somewhere.....
We do it for the joy of seeing the users struggle.
|
|
|
|
|
Hello,
Well I have this funny problem. I want to add items to my combo box in a child dialog box from my parent dialog box just before the child is shown.
To do this I have the following line
ChildDlg.m_ComboBox.AddString("Some Text");
I even tried
ChildDlg.m_ComboBox.InsertString(0, "Some Text");
I made sure too that the member variable m_ComboBox in the class ChildDlg referred to the contro (not the value) of my Combo box.
What is wrong?
Thanks,
Mike
|
|
|
|
|
Hi Mike, you have to tell us what the funny problem is. e.g. the app crashed (hm... thats really helpful), combo box not being updated, etc...
Oh, and in which message handler are you calling the "AddString"/"InsertString" methods?
|
|
|
|
|
Well the application crashes.
I have a main dialog box and in one of the functions I create a child dialog box which has the member variable m_ComboBox as public.
So in my main dialog box I have
CChildDialog ChildDlg;
ChildDlg.m_ComboBox.AddString("Some Text");
ChildDlg.DoModal();
And then when I run this application, it crashes.
So to test again I tried to Add a string to the combobox in the constructor of my child dialog but the application still crashed!
What shall I do?
|
|
|
|
|
Hello, the codegurus around the world.;)
I think that DoModal() must call OnInitDialog() in CChildDialog.
So, the location between ChilDlg and DoModal() will not
create ComboBox yet.
So, I think that you had better put AddString(...) in OnInitDialog()
of CChildDialog.
CChildDialog ChildDlg;
ChildDlg.m_string = _T("Some Text");
ChildDlg.DoModal();
And in OnInitDialog() of ChildDlg
m_ComboBox.AddString (m_string);
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
But there is no OnInitDialog() in my child dialog class!!
Even when I tried to override OnInitDialog (hoping it was there in CDialog) it did not have it already defined in the base class.
|
|
|
|
|
Hello, the codegurus around the world.;)
You can manually add OnInitDialog() with WM_INITDIALOG.
Or use WM_INITDIALOG by the class wizard, and this automatically
generates the message and its handler in CChildDlg class.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
Well, here's the problem... the control hasn't been created yet! MFC's UI classes are really wrappers around the Win32 equivalents. Having constructed the class does not imply that the corresponding controls have been created. So what you want to do is the following:
(1) create a data member (a string or an array of strings maybe?) in your child dialog to hold the data thats going into the combo box.
(2) set this data member after you have created the child dialog but before the call to DoModal (DUH!)
(3) override OnInitDialog of the child dialog (or OnCreate if its not a dialog) to pass this data into the combo box using AddString or InsertString , whichever you prefer.
--update--
Oh bugger, Masaaki beat me to it..... my link sux!
|
|
|
|
|
Hey,
I did as you told me. But now the application still mysteriously crashes.
What I want to do is that just before the child appears, a function in the main dialog box (the parent) provides the child with stuff the child needs to show in the combo box.
Since in the child I have a pointer to the parent, so I used it to call the function which should provide the child with the data for the combo box.
But somehow the application crashes!
Are we allowed to call other functions inside the OnInitDialog/OnInitInstance?
|
|
|
|
|
Yes you are allowed to call other functions in those methods. But note that in your particular case, you should be using OnInitDialog instead of OnInitInstance
-- sample pulled from MSDN --
IMPT NOTE: Remember to call the base class' OnInitDialog as shown in the sample!!
#include "MyDialog.h"
BOOL CMyDialog::OnInitDialog()
{
CDialog::OnInitDialog();
m_cMyEdit.SetWindowText("My Name");
m_cMyList.ShowWindow(SW_HIDE);
return TRUE;
}
|
|
|
|
|
The other replies have been hit-and-miss, so I'll summarize here.
You're confusing the dialog C++ object with the dialog window. The window does not get created until you call DoModal(). There is no dialog, and thus no controls to manipulate, before the DoModal() call.
The proper way is to override OnInitDialog() in your dialog's C++ class. At the time WM_INITDIALOG is sent, the window and all child controls have been created, but not yet shown. So at that time, it's fine to set up the controls.
--Mike--
http://home.inreach.com/mdunn/
While I can't be correct on all matters, I can make the reassuring claim that where I am inaccurate, I am at least definitively inaccurate.
your with and
Sonork ID - 100.10414 AcidHelm
|
|
|
|
|
I don't understand why you don't fill the combo box after the DoModal()..It's not a properly way but it is sure.
|
|
|
|
|
Hello, the codegurus around the world.;)
Fisrt of all, we are talking about the initalization of the string
in ComboBox.
And, OnInitDialog() in the parent dialog of ComboBox is best location
to do that.
Second, the location after DoModal() means that ChildDlg will disapper
since ChildDlg is the modal dialog like the message box.
This means that as long as ChildDlg is opened (DoModal still works),
we can add the new strings to this ComboBox inside or outside this dialog
as long as we can get the right CWnd of ComboBox.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
Hi All, just a quick one - How can I change the font type and size that is used to display text in a combo box? At the moment my MDI App has one located in the MainFrame toolbar, but because the Arial font looks so pants its made my app look as though its been designed for Windows 3.x. Please help make my app look better,
Cheers Guys,
Alan.
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|
Just as with any other window:
<br />
void CWnd::SetFont( CFont* pFont, BOOL bRedraw = TRUE );<br />
I vote pro drink
|
|
|
|
|
Thanks for the response, however, I have inevitably reached a problem and my efforts have gone to no avail, please help. This is the code that has resulted from my patheticness in an attempt to get it going :
int CMainFrame::OnCreate(etc..)
stdFont.CreateFont(25,12,10,10,FW_THIN,FALSE,FALSE,FALSE,ANSI_CHARSET,OUT_OUTLINE_PRECIS,CLIP_DEFAULT_PRECIS,PROOF_QUALITY,0,"Times New Roman");
SetFont(&stdFont, TRUE);
Can you see where I`m going wrong with this? I`ve tried different values for the third and forth arguments, but the combo box still uses the same crappy font to display the strings!!! Also I have checked the return value of the CreateFont function and its 1, so it must be doing something? Any advice on my failings would be hugely welcomed.
Thanks again,
Alan.
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|
Is stdFont defined locally to the OnCreate function, or is a member variable? If it's defined locally, then when OnCreate finishes, the CFont object is destroyed, so you end up with the crappy default font. I don't know if this is the problem, but I know I've done this a lot of times!
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
I found the answer, at last. I had been changing the MainFrame's standard font, and it was not being reflected in the combo box. As soon as I changed my code to m_ctlCombo.SetFont(&stdFont, TRUE), it worked! amazing! Many thanks to those of you who offered their advice on this, I very much appreciate it.
Cheers,
Alan.
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|