|
- Christian pal!
- I still have a question. How to do the same task from another class? Like the view class? Can you give me a sample code?
- Can you help me?
- Best regards,
BigMouth
|
|
|
|
|
#include "MainFrm.h" at the top of the class, then
CMainFrame * pMain = (CMainFrame*)AfxGetMainWnd();
Then do it all the same, just access m_wndToolbar via pMain-> You may have to make it public, or make the view class a friend of CMainFrame.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
- Thanks, Christian pal!
- I do not know why the method sometimes does not run stablly. Sometimes it runs ok, sometimes it does not run ok.
- Can you tell me why it happens? Need I refresh something manually?
- Best regards,
BigMouth
|
|
|
|
|
You need to run it when CMainFrame has been constructed and not destroyed.
When does it crash ?
You can do this:
CMainframe * pMain = dynamic_cast<cmainframe*>(AfxGetMainWnd());
if (pMain)
{
// use it here
}
This is how C++ does run time type information, and although it should *always* work in this case, it gives us a chance to catch if it doesn't. Whenever you request a pointer you should check it first, even if it's just with ASSERT.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
- Thanks, Christian pal!
- I still have a question. I think your codes are added to the function OnCreate, so it is sure that the CMainFrame has been constructed.
- So I think there is no need to test whether the "pMain" is NULL. IMHO
- Can you help?
- Merry Christmas,
BigMouth
|
|
|
|
|
I have a dialog based application which the user accesses through a password. Now there are 2 categories of users and depending on the login and password the application has to display 2 different user screens.
How do I do this?
Also when I first wrote this application I had just one user in mind so all the code is present in the dialog class CApplicationDlg. Is it possible for me to hide all the controls on this dialog box and create a new user screen on the same dialog box when the 2nd user type logs in?
Thanks
Mike.
|
|
|
|
|
Well, I guess the simplest way to get this done, given the original design of your project, is as follows:- Create two sets of controls for each user profile and merge them into the only dialog resource. You'll end up with a mess of overlapping controls, so you might want to do the work separately in auxiliary dialog resources and then copy and paste to the final destination. On the process some controls will be shared (i.e., they exist for both user profiles), keep that in mind and do not duplicate them.
- Have all the controls hidden by default. If you select Test on the Resource menu, the dialog should appear empty.
- Have two static arrays defined for your
CDialog class, each specifying the IDs of the controls that should appear for the corresponding user profile.
- Add a variable to the constructor of your
CDialog class indicating the user profile.
- In
OninitDialog you just have to walk thorugh the appropriate array of control IDs and call GetDlgItem(id)->ShowWindow(SW_SHOW) .
Hope this helps.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I figured that out thanks. But the problem now is that I need a menu bar for one user category and no menu for the other user category.
By default the dialog box loads a menu bar, and I want to remove it when the user 2 enters. So I did the following
CMenu* menu = GetSystemMenu(TRUE);
menu->DestroyMenu();
But the program crashes!
What do I do?
Thanks,
Mike
|
|
|
|
|
Well, maybe you can do it the other way around: by default have no menu in your dialog, and set it when needed with SetMenu .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hy!
Does anyone know how to make an aplication that do not have a rectangular window ... ( ex. diferent skin for MediaPlayer in WinXP )
Bye,
BogdanO
...the night is long ... but not long enought to do some real coding ...
|
|
|
|
|
Lots of information on the net about how to do it. Check for instance How to Create Non-rectangular Windows on the Xploiter website.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
Hi,
this should be quite an easy fix, I just don't know how.
I'm writing an internationalised program that has to store text in a file. I cannot for the life of me get the stl ifstream extractor to compile for UNICODE...
i.e. these do not work
TCHAR t[1024];
stream.getline(t,1024,'\n');
...
TCHAR t[1024];
stream >> t;
...
std::wstring w;
stream >> w;
but if I convert TCHAR to char the damn thing compiles. What am I missing? Surely something in the STL templates allow the reading of a double byte character from the stream.
Any pointers appreciated.
Matthew
|
|
|
|
|
Use wifstream , which is the instantiation of basic_ifstream for wchar_t (instead of char ). Better yet, define a macro of your own for selecting ifstream /wifstream the way TCHAR does.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
wicked, thanks. I never even knew wifstream was there.
I am very pleased indeed.
did I say thanks?
Matthew
|
|
|
|
|
I work in Windows 9x and Window 2000 environment, and I am developing a Win32/MFC application.
I got a question about the one of the "monitor properies" in Windows.
Remember ? When you are in Windows desktop, right click the mouse, and a pop-up menu shows. The last one is "Properties". And when you choose the "Property", there are 6 tabs. The 4th or 5th tab is "Effect". And, there is an item: "Show window contents while dragging".
Now, if I want to set this property ("Show window contents while dragging") in my win32/MFC application, is there any win32 or MFC API I can use in my program to do this ?
Thanks for your help !
|
|
|
|
|
It's just a registry setting, therefore you use the registry API.
--
Where are we going? And why am I in this handbasket?
|
|
|
|
|
>>It's just a registry setting, therefore you use the >>registry API.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Which registry API ? Could you explain more detail ?
Thanks a lot !
|
|
|
|
|
I found an API in MSDN: SystemParametersInfo(..),
but I still can not find any parameter that looks like the property(show window contents while dragging)..
|
|
|
|
|
The Registry Key which controls show contents of window while dragging is
Key: [HKEY_CURRENT_USER\Control Panel\Desktop]
Name: DragFullWindows
Type: REG_SZ (String Value)
Value: (0=disable, 1=enable)
You can use API RegOpenKey, RegCreateKey... in your app to check if it exists.
If so check the value and toggle it to your needs. If not create it.
Atul Dharne
#include "codeproject_users_experience_"
using namespace codeproject;
|
|
|
|
|
Call SystemParametersInfo():
SystemParametersInfo ( SPI_SETDRAGFULLWINDOWS, TRUE, 0, FALSE );
Change TRUE to FALSE to turn it off. (Messing with the user's settings w/o asking first is a Bad Thing, so don't do this w/o permission.)
--Mike--
http://home.inreach.com/mdunn/
"Not our fault we are intellectually superior to the rest of the office." -- Paul Watson in the Lounge, 12/12/2001
Sonork - 100.10414 AcidHelm
|
|
|
|
|
Hi,
Have hit the problem again of copying updated exe to the server, only to find some bright spark still has it open and has gone to lunch so the copy fails.
Now, having no access to the server, for the sake of argument, can someone point me in the right direction on how to get the info on who has a given file open from the server thru code?
Thx
Mark
|
|
|
|
|
If you have no access to the server, there is no way to know who has it open. Only the server knows that information.
--
Where are we going? And why am I in this handbasket?
|
|
|
|
|
Check out the WMI stuff here and on MSDN. Several of the WMI examples deal with network drives and open files.
Hope this helps,
Bill
|
|
|
|
|
Thx for the reply,
I can't find anything here on codeproject to do with WMI and the SDK I just downloaded makes me realise how 'stoopid' I am
Dont suppose I can prevail upon you to point me in a slightly more confined direction?
Mark
|
|
|
|