|
Alternate to error lookup you can as well use FormatMessage API(Though output is same in either case ).
<bold>- Nilesh
<italics>
"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
Thanks for your help.
I am aware of the FormatMessage API. The Error Lookup is also a good tool. However, all these come from the wrong direction; once you know the error.
My problem is that I cannot find documentation about all possible errors. I would like to write a switch statement of the GetLastError numbers and direct my code to handle important errors in a more appropriate manner than reporting them to the user. And there is where my problem comes. I do not have a list of those errors; not only for CreateFile but for almost and window function.
Look the UNIX manual for open() (E.g. in http://www.rt.com/man/open.2.html) They have a list of all possible errno values that open may return, not all possible errno values in the whole O.S. Why Microsoft never does that for Win32?? Or if it did where can I find it?
Thanks for any help
Life is river with mist ahead...
|
|
|
|
|
Well, maybe because it's difficult to maintain such a documentation.
If you're interested, you can look into the <winerror.h> header, where most of errors are described (found in any good Windows SDK)
Don't know if it does any good to you, but at least tried
|
|
|
|
|
Consider using CFile::Open() instead. That will allow you to switch on these[^] error codes contained within a thrown CFileException .
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Consider using CFile::Open() instead. That will allow you to switch on these[^] error codes contained within a CFileException .
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
is there any alternative within eVC 4.0?
thx
|
|
|
|
|
How can I get the default printer which is connected on a pc directly or on a LAN?
Thanks in Advance
|
|
|
|
|
Have a look at CWinApp::GetPrinterDeviceDefaults()
"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! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
Check out for EnumPrinters API, This should be able to get you available printers.
<bold>- Nilesh
<italics>
"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
My application uses a socket to receive periodic UDP multicast messages (messages are send every 100 millisecs and theyr size is variable).
When I run my application in some PCs, I've seen that when it receives a long message (1360 bytes or more), that packet is correctly received but sometimes the next one is lost (the socket doesn't receive it) even if it is a small one. Using a network monitor application, I've seen that this problem happens when the packet is fragmented in more than 7 packets at UDP level.
In sinthesys, the problem is that long packets (fragmented in more that 7 packets at UDP level) are received but lets the socket loose the next one. It doesn't happen any time, and it doesn't happen on any PC.
Can someone tell me what is this problem due to ?
Are there some socket options usefull to solve this problem ?
Thanks a lot !!
|
|
|
|
|
Can anyone tell me what the maximum number of unsigned chars that can be read in from a file using the read method.
TIA,
Andy
|
|
|
|
|
Hello!
I'm using VC++ in .NET Studio. I made simple MFC dialog based application with resource builder. I know how to handle some button press and event is executed on button release. But I don't know how to handle button press and button release. For example if I press (mouse button down) "LIGHT" button, virtual light would start to shine and when I release button (mouse button up) virtual light would stop shineing.
Can it be done?
Regards,
Rostfrei
|
|
|
|
|
Hi,
Can anyone suggest a way to convert a text file to bmp at runtime ,
I was able to create and save the bitmap file but was unable to append text to it.
<bold>- Nilesh
<italics>
"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
Load (or create) the bitmap, select it into a memory DC and use DrawText or TextOut to draw your text onto the bitmap the same as you would draw text onto the screen DC. Select the bitmap out of the DC and save it.
"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! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
already tried that but I don't see any text in the saved bmp file
<bold>- Nilesh
<italics>
"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
Show your code.
"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! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
<br />
CreateBitmap();<br />
<br />
m_pMemDC = new CDC;<br />
<br />
VERIFY( m_pMemDC->CreateCompatibleDC(m_pWinDC) );<br />
<br />
m_pOldBitmap = m_pMemDC->SelectObject( &m_Bitmap );<br />
<br />
CString str("This is a test message");<br />
<br />
CPen cp;<br />
cp.CreatePen(PS_SOLID, 2,RGB(255,255,255));<br />
<br />
CRect rect;<br />
GetClientRect(&rect);<br />
<br />
m_pMemDC->SelectObject(&cp);<br />
m_pMemDC->DrawText(str,str.GetLength(),rect,DT_LEFT);<br />
<br />
PBITMAPINFO pbi = getInfoStruct(m_Bitmap);<br />
<br />
CreateBMPFile("test.bmp",pbi,m_Bitmap,m_pMemDC->m_hDC);<br />
m_pMemDC->SelectObject(m_pOldBitmap);<br />
<bold>- Nilesh
<italics>
"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
Nilesh K. wrote:
CreateBMPFile("test.bmp",pbi,m_Bitmap,m_pMemDC->m_hDC);
I Believe, Such function doesn't exist in WIndow's Api!.
could you show coding for that too, as your problem may be at the time of saving!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
<br />
CRect rect;<br />
CSize size;<br />
<br />
GetClientRect(&rect);<br />
size = rect.Size();<br />
<br />
LPBITMAPINFO lpbi;<br />
<br />
lpbi = (LPBITMAPINFO) new BYTE[sizeof(BITMAPINFOHEADER) + (256 * sizeof(RGBQUAD))];<br />
lpbi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);<br />
lpbi->bmiHeader.biWidth = size.cx;<br />
lpbi->bmiHeader.biHeight = size.cy;<br />
lpbi->bmiHeader.biPlanes = 1;<br />
lpbi->bmiHeader.biBitCount = 8;<br />
lpbi->bmiHeader.biCompression = BI_RGB;<br />
lpbi->bmiHeader.biSizeImage = WIDTHBYTES((DWORD)size.cx * 8) * size.cy;<br />
lpbi->bmiHeader.biXPelsPerMeter = 0;<br />
lpbi->bmiHeader.biYPelsPerMeter = 0;<br />
lpbi->bmiHeader.biClrUsed = 0;<br />
lpbi->bmiHeader.biClrImportant = 0;<br />
<br />
UINT uUsage = DIB_RGB_COLORS;<br />
<br />
memcpy( lpbi->bmiColors, m_rgbPalette, sizeof(RGBQUAD) * 256 );<br />
<br />
m_pWinDC = new CWindowDC(this);<br />
<br />
HBITMAP hBitmap = CreateDIBSection( m_pWinDC->m_hDC, lpbi, uUsage, (void **)&m_pBits, NULL, 0 );<br />
<br />
delete [] (BYTE *)lpbi;<br />
<br />
ASSERT(hBitmap != NULL);<br />
<br />
m_Bitmap.Attach( hBitmap );<br />
<bold>- Nilesh
<italics>
"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
CPen cp;
cp.CreatePen(PS_SOLID, 2,RGB(255,255,255));
Why write white text?
Maybe the color of the bitmap is white: RGB(255,255,255), that is why the text does not show.
this is this.
|
|
|
|
|
I need to disable firewalls. If all firewall cannot be disable then at least guide me to disable WindowsXp firewall.
I am using Visual C++ 6.0
Thanks
Quaidian For Once, Quaidian For Ever
|
|
|
|
|
The firewall is unlikely to shut down quietly - you should just tell your user to turn it off, assuming you absolutely have to.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi ALL !
actually i have a main dialog which has 3 buttons
the first button when clicked dispplays a dialog
with 3 radio buttons. iam selecting one of radio
button say r1.
the second button when clicked displays another
child dialog with 2 radio buttons. out of which iam
selecting one of radio button say R1.
Now when i press the view properties that is third
button i should get the information from these
selected radio buttons that is r1 and R1 and get it
displayed in new dialog box.
iam able to display third dialog box , but
unable to retrieve info from the 2 radio buttons which
are in 2 dialog boxes.
now the problem is how to retrieve
information from the 2 dialogs and display it in the
third dialog.
So Reply me as soon as possible
Thanks in Advance,
Abhijeet Jadhav
|
|
|
|
|
The best way to do that is something like that:
Say your main dialog is CMainDlg, and your three other dialogs are CDialog1, CDialog2 and CDialog3
void CMainDlg::OnButton1()<br />
{<br />
CDialog1 Dlg;<br />
Dlg.DoModal();<br />
<br />
RadioStatus1 = Dlg.GetRadioStatus();<br />
The same thing for Button2 (retrieving RadioStatus2 from CDialog2
void CMainDlg::OnButton3()<br />
{<br />
CDialog3 Dlg;<br />
Dlg.SetRadioStatus(RadioStatus1, RadioStatus2);<br />
Dlg.DoModal();<br />
}
So, a quick explanation: RadioStatus1 and RadioStatus2 are member variables from your main dialog that will hold the status of the two radio buttons. In the CDialog1 and CDialog2 classes, you must add a handler function for the OnOk event (or when the dialog closes) to retrieve the status of the radio button and save it in a member variable of this class. Then add the member function GetRadioStatus that will return this value.
Finally, for the third dialog, you must add a function that will send the values of the buttons to this dialog before calling DoModal.
Ok, this is just an example of how to do it. Hope this is clear enough...
|
|
|
|
|
Thanks a lot cedric ...for this information
this solves my problem...in case of any doubt, i will ask you later....
Abhijeet Jadhav
|
|
|
|