|
hello!
i have a splash screen (greeting screen) in my mfc-programm. how can i change the time?(i would like to see the picture longer.)
thanks
MFC
|
|
|
|
|
search in your code for SetTimer
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
|
hello
i use static linking when i build my app but i had a tester tell me that on an old w95 machine the app couldnt load cos it was missing ws2_32.dll ... now i thought first off that static linking would put that in there but apparently not
can i distribute the ws2_32.dll as part of the installer without stuffing up old machines like that one?
thanks
"even if my world is weird it's my world" biz stuff about me
|
|
|
|
|
MS Redistribution package for W95[^]. (not needed on W98).
How low can you go ? (MS rant)
|
|
|
|
|
|
Hi,
My dialog based application don't run on another machine. In my dialog i have used the ActiveX component "Microsoft Forms 2.0 Textbox". I think that that is the problem. How can i code something to automaticly install this ActiveX comp. on a computer?
Please help me or give me a URL..
Thanks
|
|
|
|
|
This component is part of <winsysdir>\FM20.dll. Check out MSDN for further info about redistributing this stuff.
How low can you go ? (MS rant)
|
|
|
|
|
I have created a combo box control in a command bar control with the following code:
::CommandBar_InsertComboBox(hBar, hInst, 120 , CBS_DROPDOWNLIST , ID_ROOMS_COMBO, sizeof(g_arCmdbarRoomsButtons) / sizeof(TBBUTTON) );
To get a message when the user change the selected item of the combo box control I added the following message handler to my CMainFrame class:
...
ON_CBN_EDITCHANGE(ID_ROOMS_COMBO, OnEditChangeRoomsCombo)
...
void CMainFrame::OnEditChangeRoomsCombo()
{
...
}
...
So, the problem is that when the user change the selected item of the combo box control, this message handler will never called by the system!
(I work with eMbedded VC++ 3.0 and WinCE 3.0, but I think it is a simple MFC problem - a problem that I implemented something wrong).
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
MFC framework does not send ON_CBN_EDITCHANGE message if the combobox contains the CBS_DROPDOWNLIST style.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_MFC_CComboBox.asp
Kuphryn
|
|
|
|
|
Thanks! It works!
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
I read some simple char s (1 byte wide) from a file and want to build a string, based on this simple char s.
Sample:
Read 'B'
Read 'ü'
Read 'r'
Read 'o'
--> string: "Büro"
I use the following code:
while (TRUE)
{
char c = 0;
DWORD dwReadBytes;
if (!ReadFile(m_hFile, &c, sizeof(char), &dwReadBytes, NULL) ||
dwReadBytes != (DWORD) sizeof(char))
{
ErrorMessage(_T("Unerwartetes Dateiende (EOF) in Zeile %d."), m_nCurrentLine);
return FALSE;
}
if (c == '\n')
{
break;
}
str += CString((TCHAR) c);
}
The problem is the line str += CString((TCHAR) c); .
My system (PocketPC) works with UNICODE and so I have to convert the readed char to a UNICODE char .
I have used TCHAR that I can use the source code on both systems (UNICODE & non UNICODE).
So, the problem is now that when I read some chars like ö. ä, ü, ... the conersion result is a "?" .
So, when I should read the string "Büro" the result is "B?ro" . It look like, that the conversion failed!
How can I fix that?
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
check out the USES_CONVERSION; macro in msdn and W2A() and A2W()
"even if my world is weird it's my world" biz stuff about me
|
|
|
|
|
lauren wrote:
check out the USES_CONVERSION; macro in msdn and W2A() and A2W()
...but how to use with a single TCHAR ? This macros uses strings (more than a single char) and no single chars.
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Fortunately, you don't speak Spanish. You wouldn't use Buro like that..
How low can you go ? (MS rant)
|
|
|
|
|
The applicatio is for german user...
"Büro" is the german word for "Office"...
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Because casting does not convert between character sets. What I'd do is read the data into a buffer (keeping it as MBCS), zero-terminate it, then put it in a CString which will convert it for you properly.
--Mike--
"I'd rather you just give me a fish today, because even if you teach me how to fish, I won't do it. I'm lazy." -- Nish
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Thanks Mike!
I have seen...
It was a very silly bug...
*rrrhhh - Sometimes I am so stupid*
Thank you very very very much for your help on my stupid questions...
I hope I can invite you to one or some more beer when I will travel to Los Angeles anytime in the next years!
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
I am trying to capture a bitmap or an icon from a .bmp or .ico file selected by a user from a standard CFileDialog dialog.
LoadImage() always fails (returns 0 and hBitmap or hIcon are NULL).
CString strAppPath;<br />
CSString strImagesDirectory;<br />
CString pathName;<br />
CString fileName;<br />
CString extName;<br />
HICON hIcon;<br />
HBITMAP hBitmap;<br />
<br />
CFileDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY, "Bitmap(*.BMP)|*.BMP|Icon(*.ico) <br />
*.ico||", this);<br />
if( dlg.DoModal() == IDOK )<br />
{<br />
pathName = dlg.GetPathName();<br />
fileName = dlg.GetFileTitle();<br />
extName = dlg.GetFileExt();<br />
<br />
if (extName == "ico" || extName == "ICO")<br />
{ <br />
hIcon = (HICON)::LoadImage( NULL, pathName, IMAGE_ICON, 0, 0, <br />
LR_LOADFROMFILE|LR_DEFAULTCOLOR ); <br />
if (hIcon)<br />
SetIcon(hIcon, TRUE);<br />
}<br />
else<br />
{<br />
hBitmap = (HBITMAP)::LoadImage( NULL, "C:\\HAPPY.BMP", IMAGE_BITMAP, 0, 0, <br />
LR_LOADFROMFILE|LR_CREATEDIBSECTION);<br />
if (hBitmap)<br />
bmpImage->Attach(hBitmap);<br />
}<br />
<br />
}
I have tried a number of things with the second parameter of the LoadImage() call -- hard coded path to the file, path as captured by the CFileDialog, image files in the root directory and located in a variety of other locations (including the directory of the working project). Nothing works. I have searched the documentation and what I have should work.
I am working on Windows 2000 Professional and in Visual Studio .NET but in unmanaged C++ code.
Anyone have any idea whta I am doing wrong?
Sydney Liles
Software Engineer
|
|
|
|
|
The first parameter should be the instance of your module. Passing NULL instead is only for OEM images.
How low can you go ? (MS rant)
|
|
|
|
|
This is one of the things I have tried. I tried it again after I got your response. No luck.
I changed the code to look like this:
CFileDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY, "Bitmap(*.BMP)|*.BMP|Icon(*.ico)<br />
|*.ico||", this);<br />
if( dlg.DoModal() == IDOK )<br />
{<br />
pathName = dlg.GetPathName();<br />
BYTE FileBuffer[10240] = "";<br />
fileName = dlg.GetFileTitle();<br />
extName = dlg.GetFileExt();<br />
<br />
HINSTANCE hInst = AfxGetInstanceHandle();<br />
<br />
if (extName == "ico" || extName == "ICO")<br />
{ <br />
hIcon = (HICON)::LoadImage(hInst, pathName, IMAGE_ICON, 0, 0, <br />
LR_LOADFROMFILE|LR_DEFAULTCOLOR); <br />
if (hIcon)<br />
SetIcon(hIcon, TRUE);<br />
}<br />
else<br />
{<br />
hBitmap=(HBITMAP)::LoadImage(hInst, "C:\\HAPPY.BMP", IMAGE_BITMAP, 0, 0, <br />
LR_LOADFROMFILE|LR_CREATEDIBSECTION);<br />
if (hBitmap)<br />
bmpImage->Attach(hBitmap);<br />
}<br />
<br />
}
I know I am getting a valid HINSTANCE.
Any other suggestions?
BTW -- I really do appreciate the help.
Sydney Liles
Software Engineer
|
|
|
|
|
Code from MSDN[^].
How low can you go ? (MS rant)
|
|
|
|
|
Boy, I sound like my children (no, that won't work)
I did try that -- This is one of the documents I found that discusses LoadImage(). The problem remains the same. When I add this code to my own, then the LoadImage() call in the LoadBitmapFromBMPFile() fails.
BOOL LoadBitmapFromBMPFile( LPTSTR szFileName, HBITMAP *phBitmap,<br />
HPALETTE *phPalette )<br />
{<br />
<br />
BITMAP bm;<br />
<br />
*phBitmap = NULL;<br />
*phPalette = NULL;<br />
<br />
<big>*phBitmap = (HBITMAP)LoadImage( NULL, szFileName, IMAGE_BITMAP, 0, 0,<br />
LR_CREATEDIBSECTION | LR_DEFAULTSIZE | LR_LOADFROMFILE );</big> <br />
if( *phBitmap == NULL )<br />
return FALSE;<br />
I think there is something going on with LoadImage() itself. I thought that the .bmp files I was using to test might be the problem because they are very old and have not been updated. I got a .bmp with lots more information stored in the properties and it does not work either.
The only thing I can think of is that LoadImage() fails on Win2K. I read a Microsoft Knowledge Base article to this effect http://support.microsoft.com/default.aspx?scid=kb;en-us;Q329092. I do not have access to a Win9x machine with Visual Studio installed to test this theory.
Thanks though.
Sydney Liles
Software Engineer
|
|
|
|
|
What does GetLastError return after you call this function and it fails?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Funny you should ask.
I just added a call to GetLastError() a few minutes ago and realized that I had created a CFile (to get size information), opened it, read the contents of the .bmp into a buffer(in an attempt to get LoadImage() to work) and then closed it after I attempted to call LoadImage() -- GetLastError() returned 32 (ERROR_SHARING_VIOLATION). I moved the CFile::Close() to before the call to LoadImage() and now all is well.
It was a dumb thing to over look. Wish I had tried the GetLastError() sooner. Oh well.
Thanks for all of the help.
Sydney Liles
Software Engineer
|
|
|
|