|
You get an error, or only you can not see the strings?
Regards
Carlos Antollini.
Pi Five Creator
Sonork ID 100.10529 cantollini
|
|
|
|
|
If you haven't already, try doing what you did in CMyDialog::OnInitiateDialog() member function.
ralf.riedel@usm.edu
|
|
|
|
|
It's strange, isn't it? HELP!
|
|
|
|
|
I need to add basic serial port access to my Visual C++ program. I only need the program to be able to do two things:
1) Send a hex value to the serial port.
2) Wait until a hex value is received.
Baud rate will be low, I don't need anything complicated, just really basic access to serial ports, but I don't know how to do it... all the stuff on MSDN is geared towards more complex terminal emulation type stuff.
I'm not using MFC.
Thanks, any help would be greatly appreciated!
|
|
|
|
|
You can treat the serial port just like a file. In fact for Win32 programming, you have to!
m_hComPort = ::CreateFile ("COM1", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
To write a byte out:
void WriteComByte (BYTE byOut)
{
DWORD dwWritten;
::WriteFile (m_hComport, &byOut, 1, &dwWritten, NULL);
}
Reading (blocking)
BYTE ReadByte ()
{
DWORD dwRead;
BYTE byIn;
::ReadFile (m_hComPort, &byIn, 1, &dwRead, NULL);
return byIn;
}
etc.
If you don't know when you will have input, then either put the reading in a separate non-UI thread,
or use overlapped IO to read from the com port.
Good luck,
Iain.
|
|
|
|
|
Hello, i have a small problem with saving a bitmap to file.
Well, in WM_PAINT case i have implemented a code that receives a bitmap from clipboard
adds a text there and.. yep and i dont know how to save it into a file.
Please help me with it, i am searching it for 2 weeks and havent found explanation of that problem.
Ohh im not MFC programmer. Pure API.
Regards.
|
|
|
|
|
if you are getting a DIB from the clipboard, all you have to do is fill-in and write a BITMAPFILEHEADER struct, followed immediately by your DIB.
if you're getting an HBITMAP from the clipboard, you'll get to get a DIB from it then follow the steps above. use GetDIBits.
-c
Alcohol is the anesthesia by which we endure the operation of life.
-- George Bernard Shaw
|
|
|
|
|
So there isnt any function that makes it automatically?
I mean something like savetobmp(...)?
Could you please, help me to solve this problem?
|
|
|
|
|
no, there is no such function.
the process i described can be done in less than 10 lines of code, if you have the DIB. it is entirely trivial.
-c
Alcohol is the anesthesia by which we endure the operation of life.
-- George Bernard Shaw
|
|
|
|
|
Yes, but as you said "if i have the DIB". The operation i am doing is:
OpenClipboard(hwnd);
hBitmap = (HBITMAP)GetClipboardData(CF_BITMAP);
Please, help me to write those "10 lines of code".
|
|
|
|
|
|
Big thanks, you really helped me.
|
|
|
|
|
I found problem on my application developed on Visual C++ 4.0. When our client run the application, we found the Dr.Watson crash dialog. Since we cannot reproduce the problem, we have to create PDB or DBG file to place on the client's machine to track the failed module. But we faced the problem in creating PDB or DBG file. As we sent the PDB file to the client's machine and wait for the crash, we find only 'No symbol' shown in the Dr.Watson log file. I think it may cause from incorrect build PDB file or configuration. Does anyone know to use PDB to track this kind of problem?
Another way about DBG file, we also don't know how to create DBG file. Does anyone have any suggestions on this issue?
|
|
|
|
|
Hi,
I would like to know if it is possible to load a .gif image into a button?
The idea is to make the button image flash.
Let say the button must change from green to grey and back again continuously.
Thanks
Regards
Rui
|
|
|
|
|
Ruca wrote:
I would like to know if it is possible to load a .gif image into a button?
there is no built-in support for that. you might be able to find a control here.
-c
Alcohol is the anesthesia by which we endure the operation of life.
-- George Bernard Shaw
|
|
|
|
|
Ok, after a long search on the internet I finally stumbled across the packet filtering API built into Win2k and up. Unfortunately this is extremely badly documented.
I would greatly appreciate anyone that can give me a simple example containing the PfCreateInterface function or anything along those lines. When I do a call to PfCreateInterface all I get is a 'Overlapping I/O in progress' error.
Any help at all will be more than appreciated.
Thanks
Shiver
|
|
|
|
|
is it possible to format a string so that it displays multiple lines in the tooltip? I'm using CButtonST and don't really understand why escape sequences don't work.
Thanks!
|
|
|
|
|
Hi everybody,
I have a button on the status bar. The following code is included in mainframe::oncreate function:
CButton * button = new CButton;
button->Create(_T("SMS"), WS_CHILD | WS_VISIBLE | BS_FLAT | BS_BITMAP, CRect(0, 0, 0, 0), &m_wndStatusBar, IDC_BUTTON_STATUS_BAR);
button->SetBitmap( ::LoadBitmap( NULL, MAKEINTRESOURCE(IDB_BITMAP5) ) );
I want to place a BItmap in the button, as can be seen. But the above code does not work. The button simply appears empty.
button->SetIcon(::LoadIcon(NULL, MAKEINTRESOURCE( IDI_ICON1 )) );
An attempt at loading an icon does not work either. (with the BS_ICON set).
Can anyone help?
Thanks
Rui
|
|
|
|
|
I guess the problem lies in the CRect(0, 0, 0, 0) part.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi Joaquín,
thanks for the try, but the following works:
CButton * button = new CButton;
button->Create(_T("SMS"), WS_CHILD | WS_VISIBLE | BS_FLAT | BS_ICON, CRect(0, 0, 0, 0), &m_wndStatusBar, IDC_BUTTON_STATUS_BAR);
button->SetIcon( AfxGetApp()->LoadIcon( IDI_ICON1 ) );
I cannot understand why, this works and not the previous code. Why must I use AfxGetApp to LoadIcon() and not just LoadIcon()?
Any answers?
Rui
|
|
|
|
|
Because you need an instance handle in order to find and load the icon. The NULL value you supplied as the first parameter to ::LoadIcon and ::LoadBitmap was insufficient.
|
|
|
|
|
Thanks for the explanation.
How do I get the hinst?
Cheers
Rui
|
|
|
|
|
OK, I understand that, what is bothering me is, after reading the MSDN documentation, I don't understand how to get the "Handle to an instance of the module whose executable file contains the icon to be loaded"?
Thanks for your time and excuse my ignorance.
Cheers
Rui
|
|
|
|
|
The hInstance parameter is passed by Windows to WinMain when an application is started. Use AfxGetInstanceHandle() to get it. If that does not answer you, I don't understand your question. Try rephrasing it and posting again and perhaps someone can help.
|
|
|
|
|
CComVariant var("Somevalue");
How to convert this to C-style string
|
|
|
|