|
I have a VC++6 application that has two edit fields (m_edit1, m_edit2)and a button. When the application starts, m_edit1 displays the following text:
lastname;firstname;gender;phoneNumber;email
I want to read the third field "gender" and display it in m_edit2 when the button is pressed.
Any help will be greatly appreciated
|
|
|
|
|
use CString a;
a.Find and parse it
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
Use AfxExtractSubstring() for this.
CString strText, strGender;<br />
m_edit1.GetWindowText(strText);<br />
AfxExtractSubstring(strGender, strText, 2, ';');
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
is it possible to initialize the browser dialog with a specified directory when call SHBrowseForFolder?
I mean:
when the browser dialog displays, it selects a directory as Initial Directory.
in OPENFILENAME, we can set lpstrInitialDir then call GetOpenFileName.
includeh10
|
|
|
|
|
In the BROWSEINFO structure, set the lpfn member to a callback function. In that callback, send a BFFM_SETSELECTION message back to the SHBrowseForFolder dialog, passing the path in the LPARAM parameter.
See http://www.codeproject.com/editctrl/fileeditctrl.asp[^] for an example of code that does this.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Hi. im kinda used to the "I write the methods and classes, call them from the main()" way of programming but now in MFC I cant find a way of doing this. Does mfc still work that way???
|
|
|
|
|
It's not just MFC, it's Windows that doesn't work that way.
Windows is an event-driven operating system and needs a completely different approach to programming. Learn what that involves first and then decide whether or not to use MFC to do it.
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
|
|
|
|
|
What you describe is the difference between synchronous and asynchronous programs. DOS and text-based programs are based on the former, while Windows is based on the latter.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
From a layman's prepective MFC and Windows apps have InitInstance() and WinMain() as a parallel to "main() programmers"
Dharani Babu S
|
|
|
|
|
What in the world are you talking about? Not all MFC applications have an InitInstance() method. While a GUI-based Windows application has a WinMain() function, a text-based Windows application has a main() function.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi all i wanna how to create tab control
i wanna create
(1)dialog tab
(2)form view tab
|
|
|
|
|
I want to use the follow codes to capture screen ,but I get a black screen.
Please help me to find the errors!
thanks!
HWND hDesktopWnd=::GetDesktopWindow();
HDC hDesktopDC=::GetDC(hDesktopWnd);
HDC hDesktopCompatibleDC=CreateCompatibleDC(hDesktopDC);
HBITMAP hDesktopCompatibleBitmap=CreateCompatibleBitmap(hDesktopDC,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN));
SelectObject(hDesktopCompatibleDC,hDesktopCompatibleBitmap);
BitBlt(hDesktopCompatibleDC,0,0,GetSystemMetrics(SM_CXSCREEN)
,GetSystemMetrics(SM_CYSCREEN)
,hDesktopDC,0,0,SRCCOPY);
// InvalidateRect(NULL,false);
HDC hBmpFileDC=CreateCompatibleDC(hDesktopCompatibleDC);
HBITMAP hBmpFileBitmap=CreateDIBSection(hDesktopCompatibleDC,&bi,DIB_RGB_COLORS,&pBits,NULL,0);
SelectObject(hBmpFileDC,hBmpFileBitmap);
BitBlt(hBmpFileDC,0,0,width,height,hDesktopCompatibleDC,0,0,SRCCOPY);
// the fellow codes is save the bitmap
HANDLE hFile=CreateFile((unsigned short *)szFileName,GENERIC_WRITE,FILE_SHARE_WRITE,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
bi.bmiHeader.biBitCount=16;
// bi.bmiHeader.biClrUsed=0;
bi.bmiHeader.biHeight=GetSystemMetrics(SM_CYSCREEN);
//GetHeight();
bi.bmiHeader.biWidth=GetSystemMetrics(SM_CXSCREEN);
//GetWidth();
bi.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
bi.bmiHeader.biPlanes=1;
bi.bmiHeader.biCompression=BI_RGB;
// bi.bmiHeader.biXPelsPerMeter=0;
// bi.bmiHeader.biYPelsPerMeter=0;
// bi.bmiHeader.biClrImportant=0;
DWORD bitSize=((bi.bmiHeader.biWidth*16)/8)*bi.bmiHeader.biHeight;
bi.bmiHeader.biSizeImage=bitSize;
bitHeader.bfType=((WORD)('M'<<8)|'B');
bitHeader.bfReserved1=0;
bitHeader.bfReserved2=0;
bitHeader.bfOffBits=(DWORD)(sizeof(BITMAPFILEHEADER)+bi.bmiHeader.biSize);
bitHeader.bfSize=bi.bmiHeader.biSizeImage+bitHeader.bfOffBits;
if(hFile!=INVALID_HANDLE_VALUE)
{
DWORD dwRet=0;
WriteFile(hFile,&bitHeader,sizeof(bitHeader),&dwRet,NULL);
WriteFile(hFile,&bi.bmiHeader,sizeof(bi.bmiHeader),&dwRet,NULL);
WriteFile(hFile,pBits,bi.bmiHeader.biSizeImage,&dwRet,NULL);
CloseHandle(hFile);
}
DeleteDC(hBmpFileDC);
DeleteDC(hDesktopCompatibleDC);
::ReleaseDC(hDesktopWnd,hDesktopDC);
DeleteObject(hBmpFileBitmap);
DeleteObject(hDesktopCompatibleBitmap);
|
|
|
|
|
Do not get the desktop window DC. It causes serious problems.
Instead of this
HWND hDesktopWnd=::GetDesktopWindow();
HDC hDesktopDC=::GetDC(hDesktopWnd); write this
HDC hDesktopDC = ::CreateDC("DISPLAY",0,0,0);
|
|
|
|
|
Hi All,
I'm facing a strange problem.
The condition is like this:
minimize the application from the taskbar when a dialog is displayed
or a automatic dialog is displayed when the application is in the minimized position.
When the user clicks to activate this minimized window,only dialog box is coming up and the application's main window still remains minimized.
This is happening sometimes.
Can some one tell me how to make the main window also to come up along with the dialog box when the window is activated from a minimized position
Thanks in advance
Raghu
|
|
|
|
|
Hello,I want to capture the screen with GDI functions ,
could you give me some samples?
my computer does not support GetDIBit()function,
Thanks
|
|
|
|
|
Try this one.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
web is an instance of CWebBrowser2;
use following code to display a page
CString cs="http://company.com/some.html";
web.Navigate(cs, 0, 0, 0, 0);
how do I know if user is offline or the URL is unavailable?
I need to open a local page if URL above can't be displayed.
thx
includeh10
|
|
|
|
|
Hi,
I am using ReportEvent() to write an event to the event log. I see the event in the event viewer, but then I try to double click it (for properties), event viewer crashes.
I tried reducing the number of characters in the logged event and it works. Does anyone know what the max chars permitted by the event viewer are?
Thanks!
|
|
|
|
|
I am trying to debug my app in MS Visual C++ 6.0 and when I come to an unhandled expression I get a dialog that pops up that says: Please enter the path to STRLEN.ASM...all I need to know is which statement is causing the error. Any suggestions?
|
|
|
|
|
What line of code is blowing up when you get this ? Or aren't you stepping through your code ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
That's the problem...the dialog pops up and then when I hit cancel it takes me to the funny looking assembly code (or whatever it may be)
|
|
|
|
|
So, you should set a breakpoint and step through the offending code. Or check the stack trace to see where the call has come from.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
I'm running embedded visual C++, and creating a little program for pocket pc 2002-3. I have created a menu resource which I want to link to the main dialog that I use. Now for somereason everything compiles correctly, but when I run the program, no menu. hmmmm Anyone out there able to help.
Thanks
JOchum
|
|
|
|
|
Rebuild all the resources and if it does not work still check the association of the MENU ID with the function that creates it .
Dharani Babu S
|
|
|
|
|
Hi
I have same problem. Menu is loaded fine but is not attaching to Dialog.
Did you find a solution for this. I am new to PPC stuff.
Please tell me your solution.
Thanks in Advance.
-----------------------------
In my dream, I was dorwning my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|