|
Hi,
I have created an new application in vc++6, which when run, opens with the ususl CView screen. I want to make a username and password dialog box to apperar befor the CView screen..i.e. if the u/n and p/w is correct, only then the application should open.
Please can you tell me how to do this.
Thanks.
Tara
Fortitudine Vinsinues!
|
|
|
|
|
BOOL SampleApp::InitInstance()
{
CWinApp::InitInstance();
// Display a login dialog box
CLoginDlg dlglogin;
// Check is user press cancel
// Assuming all the validation are handle before returning
if(dlgLogin.DoModal() == IDCANCEL)
return FALSE;
..
.
.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
Regards
Amar
-- modified at 3:25 Saturday 10th June, 2006
|
|
|
|
|
Thanks. I tried it, but I am geting the error ''dlgLogin' : undeclared identifier'
I have created the dialog, included the header file etc. Why is this happening?
Thanks.
Fortitudine Vinsinues!
|
|
|
|
|
CLoginDlg is not a built in class. You have to write it your own. I am giving just e.g.
Regards
Amar
|
|
|
|
|
Please can you give me an idea how to write it.
Fortitudine Vinsinues!
|
|
|
|
|
I wanan know that how can we recover data if the clusters are scattered ? I know that data can be recovered from FAT (flopy) if clusters are in a contigious space ,I dont know how to do it if we hav clusters separated on the whole FAT partition.. Plz some body help.....
|
|
|
|
|
For example, I want to create mem dc for a client window.The client size is (100, 200) ,but i want create a larger mem dc which may be (1000, 2000),
The code lists below work well on xp but fail in 2000, why?
CDC * pDC = CreateCompatibleDC(this);
CDC m_memDC;<br />
m_memDC.CreateDC( pDC );<br />
HBITMAP hbitmap = m_memDC.CreateCompatibleBitmap( width, heigth ); <br />
May be I just can create a bitmap which size is smaller than the client window on windows 2000??
if i still want to create a larger one, how to do this?
What do you think ? Can give me some help?
thanks!!
-- modified at 22:58 Friday 9th June, 2006
|
|
|
|
|
Error 87 is "The parameter is incorrect" (Use the error lookup tool that comes with VS)
Also, I didn't realize the CDC had a CreateCompatibleBitmap() member function.
And CDC::CreateDC usually takes 4 parameters, none of them a pointer to a CDC object.
I am suprised you even get the code to compile.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Thanks!
And I'm sorry, I made a clerical error.
The code can work well on xp but failed in 2000.
I think ms may be make some improvement.
Win2000:
If I use like this,
CreateCompatibleBitmap( pDC->m_hDC, 1000, 2000 )
//the last error code is 8( not enough memory )
CreateCompatibleBitmap( m_memDC->m_hDC, 1000, 2000 )
//the last error code is 87 ( invalid parameters )
WinXp
CreateCompatibleBitmap( m_memDC->m_hDC, 1000, 2000 )
//the last error code is 0
Why I will create a bitmap which size is larger than client window?
Because I want to draw everyting on this bitmap.
|
|
|
|
|
// Something like this will get you to the next step...
CBitmap bmp;
CDC memDC;
CClientDC dc(this); // Will clean itself up when goes out of scope
memDC.CreateCompatibleDC(&dc);
bmp.CreateCompatibleBitmap(&dc,1000,2000);
memDC.SelectObject(&bmp);
// Add error checking, etc...
// NOTE: The CClientDC is not needed if in OnDraw
|
|
|
|
|
Thanks!
I find the problem, the parameter w that used in function CreateCompatibleBitmap(m_memDC->m_hDC, w, h) is too big, I set default value is 65535, because msdn say this parameter is a int.
It's a puzzle why I can not set the max value to this parameter, may be it out off CDC's default allocable memory.
??
-- modified at 1:00 Saturday 10th June, 2006
|
|
|
|
|
Our app creates a main dialog window and uses SetIcon to set the taskbar icon. That works fine. Then that window creates another modeless dialog and it too uses SetIcon. The taskbar then groups the two icons, but the icon it uses is directly from the app's resource file (IDR_MAINFRAME). How can I set that (group) icon too? Interestingly I remvoed the IDR_MAINFRAME icon def from the resource file and I get a black square for the taskbar group icon!! (actually the black square only resulted after I used TweakUI to clean out the cached icons -- windows is just sooo frustrating)
Thanks for any hints on this very (typically) frustrating mfc/windows behavior!!
Jeremy
|
|
|
|
|
If your using VC++ 6.0, messing with the Resource files directly can sometimes get you some interesting artifacts on the dialogs that can be undone but it takes some trial and error jacking around. Just make sure to copy the project before making direct modifications to those resource files. My favorite artifact is the blue line mish-mash pattern.
|
|
|
|
|
Dear all;
I am trying to make some drawings on a dialog based application. As far as i have understood, its better to place a Static control and draw on it instead of directly drawing on top of the dialog.
As i am trying to achieve this, i am a little bit confused and gona be needing some of your help.
I have added a picture control to my dialog and created a member variable for it of type CStatic. Now I need to subclass the picture control in which i will be overriding the OnPaint() function. I do not know how to perform this subclassing ?
Thanx
llp00na
|
|
|
|
|
I wouldn't add a picture control, I'd add a static control and subclass that. But you have to specify that you want to receive messages by adding 'SS_NOTIFY' (or something like that) to the window's style. have a look here at my Modeler[^]
My Music | My Pics | My Articles
BlackDice
|
|
|
|
|
Greetings:
I'm developing a project under Visual Studio 2003. It's an MFC C++ project using the SDI framework.
I have just created a simple dialog box under the resource editor (I already have lots of dialogs). I gave the dialog a resource name "IDD_WHATEVER_DLG" and then double clicked the dialog to launch Class Wizard. I get the Class Wizard window and I specify that I want a simple CDialog derived dialog. I fill in the class name input and click "Finish".
Nothing happens. I don't get an error message of any kind. The Class Wizard input box closes, but I look through my project directory and it does not seem to have created the class files.
I have closed VS and restarted it. I have checked to ensure that none of my project files are READ-ONLY. I have plenty of hard drive space. I have deleted the ASP file and reloaded the project. I have sacrificed a chicken and tried again repeatedly. Same result every time.
Does anybody know what the problem might be?
Thanks in advance!
Mark
|
|
|
|
|
With the project closed...
Try the old "delete the .ncb file to make my classes reappear" trick that works all too well on VC++ 6.0. I'm not sure I've encountered it yet on VC++ 2003 but my intellisense "out to lunch" error still happens on 2003 and the .ncb trick "sometimes" fixes it.
For what it's worth
|
|
|
|
|
Hi ,
I have written a cgi script using C++, which it is going to be executed on a web browser. I was trying to do a "system()" command in cgi script to open another URL in the same browser. I was able to execute the cgi script calling the "system()" command successfully at the command line, but I had a problem when cgi script is on the web browser. Is this a permission problem? Or maybe there is another way to call an URL in the same browser from the cgi script?
Thank you ,
Lynniz
|
|
|
|
|
Lynniz wrote: I was trying to do a "system()" command...
Why use this antiquated function when ShellExecute() exists?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
Does ShellExecute()work with Linux? I thought this was for Windows only.
Thank you,
Lynniz
|
|
|
|
|
I don't know. You are, however, on a VC++ forum so Windows is implied.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Lynniz wrote: I have written a cgi script using C++, which it is going to be executed on a web browser.
Not sure what are you really trying to do, but cgi scripts are executed on a server, not on a web browser.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
This is what I have right now:
I have made a HTML page that contains an image map and a form. When I click on the image map, it is going to pass the coordinates of the clicked point to a cgi script. The cgi script is used here to parse the string and get the coordinate values and update the the original HTML page with the new coordinate values filled in in the form.
What I did in the cgi script was I made a copy of the orginial HTML page and saved it under a different name. After parsing the string and get the new coordinate values, I open up the new HTML as a text file and go in to update the form with new coordinate values. After I am done with that, I am trying to open the new HTML page in the same browser where the original HTML page is at. So this way it looks like to the viewer that the original HTML is beind updated. That is why I was trying to use a system command to call the new HTML page. I was able to call the new HTML page on the commandline, but I wasn't able to call it when I am using the server to execute the cgi script. Last thing, this is in a Linux enviroment.
I am probably doing it the harder way. Does this sounds more clear to you?
Thank you.
-- modified at 7:52 Monday 12th June, 2006
|
|
|
|
|
A graph was drawn using a CDC on a class derived from CWnd. This was done in OnPaint(). I want to clear this graph when the user presses a button. What code do I ned in the button press?
thanks,
sb
|
|
|
|
|
You don't clear the CDC, you just 'ask' for a repaint, that will erase everything. You can call Invalidate() for that.
Cédric Moonen
Software developer
Charting control
|
|
|
|