|
First off, thank you for purchasing my book. Second, your problem can be chalked up to the joys of writing a book while working on a beta product As a result when the UI changed in Visual Studio, that particular demo became incorrect. Here's how to solve the problem.
Instead of checking or unchecking the "Control variable" check box, you need to select the appropriate entry in the Category combo box. Long story, short. Microsoft using ambiguous terms to represent two different things. Checking the "Control variable" checkbox is how you tell Visual Studio that you're either creating a simple member variable for a class (non-DDX) or you're creating a DDX variable that will be associated with a control on the dialog.
The Category combo box is where you state whether you're creating a value DDX member variable or a control DDX member variable. In your case, you need to keep the "Control variable" checked and select Value from the Category combo box. You'll then see a default type of CString. Simply type in your variable name and ignore the bit in the book about having to manually add a DDX_Text entry.
Sorry for the confusion.
Cheers,
Tom Archer
Inside C#, Extending MFC Applications with the .NET Framework
It's better to listen to others than to speak, because I already know what I'm going to say anyway. - friend of Jörgen Sigvardsson
|
|
|
|
|
Don't worry about it. It's straightened out now. Thanks for clearing up the why's and how's
So that's why that error sneaked in there - because of a beta product. Well, that's hardly your fault then.
Anyway I'm still reading, and so far I'm getting my money's worth. It's really good - so there you go.
Well I'll return to the wonders of Documents and Views in MFC now. Take care.
|
|
|
|
|
You're very welcome. Now that I've finished my "Extending MFC Applications with the .NET Framework" book, I'll be putting up a book support site this weekend that will contain things like an errata and discussion board. If you'd like I'll email you once it's live (aiming for Monday).
Cheers,
Tom Archer
Inside C#, Extending MFC Applications with the .NET Framework
It's better to listen to others than to speak, because I already know what I'm going to say anyway. - friend of Jörgen Sigvardsson
|
|
|
|
|
I would very much like that; yes please. I'm also the happy owner of Inside C# 2nd Ed, i.e. such a site could come in handy
Thanks again...
|
|
|
|
|
Greetings,
I am trying to print some text data from a form view, and I overwrote the "OnPrint" to ouput text data from some edit fields on the form. I just get the string member data from the edit boxes, and do a drawstring on the dc.
The printed hard copy output of the text outputs fine, but when I do a preview of the text it appears to be a much smaller font size, and hardly shows up in the preview window.
I assume it has something to do with it be screen coordinates, whereas the printer coordinates are different. But I am not sure.
Thanks in advance for any suggestions.
|
|
|
|
|
Does anyone know how to implement docking toolbars in a dialog app? There are articles about toolbars in dlgs but the ones for docking all use EnableDocking called on CMainFrm which as far as I can see is not available.
|
|
|
|
|
Add a toolbar data member to your dialog class then in oninitdlg
m_Tool.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC );
create your toolbar
then right after that call
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
and that should do it
|
|
|
|
|
Hi!
I have a problem
Well, I have a MS Web Browser activeX in my application, and I want to fill in automatically the username and password in a htaccess authenticatification window (like logs.powerhouseprogramming.com [^]). If you have any idea at all how to do this, please let me know.
Thanks!
PS: you can write directly to dorutzu@personal.ro
|
|
|
|
|
yea..I also wanted to know what if we wanted to fill the form on the webpage automatically (This is bit different that the question asked)
like latest GOOGLe toolbar does...
Thnaks in advance..
|
|
|
|
|
You probably could use appropriate POST request, but it will require some winsock spying. I assume that site intstalls cookie on authorisation.
However, I would probably go with well tested by me techniques of just writing win32 hook, or spawning a separate thread:
that will wait for:
1. ShowWindow or FindWindow (Caption: "Enter Network Password", class #32770(Dialog));
2. GetDlgItem(0x411) -> should exist, it should be static control and GetWindowText should return "logs.powerhouseprogramming.com";
3. GetDlgItem(0x4C2) -> should exist, it should be edit control and here you SetWindowText to "UserName";
3. GetDlgItem(0x4C3) -> should exist, it should be edit control and here you SetWindowText to "Password";
4. After you've done all 3 above: just Send or PostMessage to the dialog: WM_COMMAND, IDOK --> "OK" button has id=1 (IDOK)...
Use SPY to see if I'm right in above sequence.
Don't blame me, not the best solution: but fast to implement...
Regards
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
I have an application where the user opens many files at once ( MFC MDI ), and the filenames are stored in the MRU list under the File menu. That is fine with me. I would like to disable all these filenames showing up under "Recent Documents" in Windows XP. Is there a way to open files in Win32 and MFC so that the documents do not show up in this list ?
|
|
|
|
|
Are you not wanting files added to the MRU list itself (a CRecentFileList object maintained by CWinAPP), or are you just not wanting the items from the MRU list showing up in the File menu?
Read Paul DiLascia's August 1999 MSDN article about this very subject.
http://www.microsoft.com/msj/0899/c/c0899.aspx
|
|
|
|
|
Checking the MSDN
void LoadStdProfileSettings( UINT nMaxMRU = AFX_MRU_COUNT );
states
Call this member function from within the InitInstance member function to enable and load the list of most recently used (MRU) files and last preview state. If nMaxMRU is 0, no MRU list will be maintained.
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
|
|
|
|
|
Sorry, maybe I'm not being clear.
When you click on the start button in Windows XP, a small window pops up and one of the selections is "My Recent Documents". I do not want my files to be added to THAT list.
|
|
|
|
|
Hi,
I'm having a problem with a combobox using VC++ 6 and Windows 98.
When I click in the combobox and call his ondropdown event, it seems that the mouse focus stays in this object and if I click (using mouse) in another control of the dialog, my code calls again the ondropdown event of this combobox.
So, I'm not able to click using mouse in another part of the dialog.
Some tests I have made show that this behaviour occurs just on Windows 98 SO.
Could anybody help me out, please?
Thanks in advance,
Felipe
|
|
|
|
|
I has found a article in the Knowledge Base Q326254.
The important point is
... When the ComboBox control is dropped down, the ComboBox captures the mouse to use its input to select the items that are in the ComboBox. ...
It means, only the ComboBox receives mouse messages while they is dropped down.
MatLin
|
|
|
|
|
Hi all,
I wish to create a dialog from within my non-mfc dll. I want to start the dialog as soon as possible! Can I do it in PROCESS_ATTACH...? The docs says only simple initialization is allowed there.
Anyone?
/T
|
|
|
|
|
In DLL_PROCESS_ATTACH, I call a function that creates and displays the window. Don't know if this is the correct way, however it works like a charm.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Can you not have the dialog as a static instance of the dll? Then the dialog will be constructed as soon as the dll is loaded, and its done in the correct order?
|
|
|
|
|
Another way is to define a function Initialise, and when the app loads the dll, call GetProcAddress(yourdllhandle, "Initialise"), which returns a pointer to the function which you can use to start the dialog, whether its modal or not.
|
|
|
|
|
Read the docs on DllMain() , it has lots of warnings about what you aren't supposed to do, such as call APIs outside of kernel32. If your code works, then you're lucky.
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Latest art~!@#2rDFA#@(#*%$Rfa39f3fqwf--=
NO CARRIER
|
|
|
|
|
Oh, I must have overread it, thanks for the info. Maybe I should redesign my code
modified 12-Sep-18 21:01pm.
|
|
|
|
|
|
Ok... so HOW then do I create and call a dialog/window in a dll as soon as possible...?
Actually, what I want is a splash screen that kicks in when somebody calls LoadLibrary(mydll).
/Tommy
|
|
|
|
|
Inside PROCESS_ATTACH, is this a bad thing to do you mean:
----
hSplash = CreateWindow(
"BUTTON",
"Tommy testing Splash Screen...",
WS_POPUP | BS_FLAT,
(sx-W)/2, (sy-H)/2,
W, H,
NULL,
NULL,
hdll,
NULL);
ShowWindow(hSplash, SW_SHOW);
UpdateWindow( hSplash);
}
// ... processing ...
if ( hSplash)
DestroyWindow( hSplash);
----
|
|
|
|