|
hemanju wrote: want to write data related to my application to registry
Great. That means you are privileged but BEWARE VISTA settings
hemanju wrote: i want to know how to write it programmatically, got my point
Yes I understood it [ ]
RegCreateKeyEx - The RegCreateKeyEx function creates the specified registry key. If the key already exists, the function opens it.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
If you need to get help you should be specific with your questions.
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
Do you want to write in registry or you want to get backup of registry? I dont know do you need to CRegKey Class or no?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
COleClientItem::OnGetWindowContext takes CFrameWnd pointer. Now I deriving frame window class from CFrameWndEx. I am getting error when I send the CFrameWndEx pointer to this function. Is there any similar function to COleClientItem::OnGetWindowContext. Please let me know if anyone knows.
|
|
|
|
|
COleClientItem::OnGetWindowContext takes CFrameWnd pointer. Now I deriving frame window class from CFrameWndEx. I am getting error when I send the CFrameWndEx pointer to this function. Is there any similar function to COleClientItem::OnGetWindowContext. Please let me know if anyone knows.
|
|
|
|
|
|
|
i want to know how to set IPAddress control in status bar.
thanks
|
|
|
|
|
you have the ip address. Convert it to some string format and use
SetPaneText (/*params*/) API from CStatusBar class
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Your question ranges over a few subjects.
1/ Putting a status bar on a dialog - and the other reply points you at an article for that.
2/ Putting a control on a pane
3/ and putting it in the Nth pane.
http://www.codeproject.com/KB/miscctrl/progressbar.aspx[^]
Will help with (2) and (3). It uses a progress bar, but that will be easily adaptable to another control type.
Good luck!
Iain.
|
|
|
|
|
I am working on a Win32 based GUI, which has a menu with a static area defined as
CONTROL "",IDC_GRAPH,"Static",SS_GRAYFRAME,17,119,264,54
in the rc file.
In my OnPaint(), the following code gets executed
HWND hStatic = GetDlgItem(m_hWnd,IDC_GRAPH); //m_hWnd is CWnd handle
RECT pRect;
HDC hStaticDC= GetDC(hStatic );
GetClientRect(hStatic,&pRect);
iCX = (pRect->right - pRect->left)/2;
iCY = (pRect->bottom - pRect->top)/2;
COLORREF bkColor = GetBkColor(hStaticDC);
HPEN pen = CreatePen(PS_SOLID,8,bkColor);
MoveToEx(hStaticDC,iCX+4,iCY,NULL);
LineTo(hStaticDC,iCX1+4,iCY);
The code compiles correctly. But the bkColor gets CLR_INVALID and MoveToEx and LineTo returns a zero value. Where have I gone wrong?
modified on Thursday, December 11, 2008 4:20 AM
|
|
|
|
|
Are you using the static as a placeholder on your dialog where your drawing is suposed to go? If so, why don't you simply acquire its position and then draw into the dialog's DC? And make your static non-visible? I think it's a simpler method than trying to draw onto a static from another windows OnPaint... anyhows, are you sure you get a correct DC for that static? And why do you MoveToEx and LineTo the same coord? (*iCX+4,iCY), if you want to make a point use SetPixel or SetPixelV instead. Am not sure if 0 length lines are drawn as a point by GDI or not though.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
Recently I came to know that MFC in VC++ 2008 has been enhanced to a great extent with tabbed MDI views, ribbons etc. to name a few. This means a fully dedicated book on VC++ 2008 is the need of the hour.
I have few books on VC++ 6 & 2003. But to fully utilize the potentials of the 2008 version these are not sufficient.
Can anybody suggest a good book on VC++ 2008?
Thanks in advance.
|
|
|
|
|
Sorry I don't have any good suggestions on Visual C++ 2008.
Hope you're into native programming. If you're already comfortable with the existing MFC, C++ Concepts (VC 6 Above), I think you can easily grasp the Changes in Visual C++ 2008[^]
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
Hello
My application is a multithreaded MFC VC++ application and I would like to implement logging support so that the logging has the following features:
1. Log messages based different levels of logging
2. Log different data types like CStrings, dump custom classes, windows handles etc, numeric values.
3. Log thread id's and other info
Can somebody suggest me a good logging library with all this support which can be used? What about Pantheios logging library, would it suffice my requirements?
Thanx
|
|
|
|
|
|
Hai !
I have a device connected to a COM port, i send a command to the device, the device responds, this response is stored in the buffer of COM port.
I read part of the response from buffer, and send the next command, now if i read response from buffer, i get the old remaining response plus the new response.
so i want to clear the buffer before i send a new command!
so how to clear the buffer of a COM port !
thanks !
|
|
|
|
|
How do you read and write to the Buffer?
|
|
|
|
|
Using the handle of Port along with ReadFile () and WriteFile ()
|
|
|
|
|
When communicating directly with the serial driver through the ::WriteFile() and ::ReadFile() API, you cannot "flush" the read buffer.
The file API contains the ::FlushFileBuffers() function, but it only flushes the transmit buffer if the handle refers to a communications device such as a COM port.
You have to read the entire response from your first request before issuing a new request to the device.
Why does this present a problem for you? Is it due to the lack of transmission protocol that you don't know how much data to expect from your device?
Some way you have to know when you've received the complete response from your device, either by protocol or by a timeout.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Are you specifying the FILE_FLAG_OVERLAPPED flag in CreateFile()..?
|
|
|
|
|
Ummm, I guess you replied to the wrong guy...
However, specifying the flag for overlapped mode doesn't make a difference regarding "flushing" the receive buffer in the serial driver.
On the other hand, overlapped mode should be used in any case.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
To be more specific :
The context where i want to clear buffer is somewhat as follows :
The device which is attached to the COM port is sujected to a specific Baudrate, parity, databit and stopbit, whose values i do not know beforehand. so i send the command for all combinations of baudrate, parity, databit stopbits.
During the process i receive junk/unnecessary response for a wrong combination, and i get correct/ expected response only for correct combination of baudrate, parity, databibit and stopbit.
so i want only to read the correct response and ignore others !
I know correct value starts with a specific value, so when ever there is a response starting with the specific value, I read it else I ignore it.
Now for the responses which I get for wrong combination donot start with a specific value so I ignore them hence they get accumulated in the buffer, now when the correct combination is reached and I try to read the response it starts with previous junk values as this response doesnot start with my specific value so it gets ignored in way I lose my correct response also, so I want to clear the buffer befor I send my command.
Thanks !
|
|
|
|
|
kapardhi wrote: The device which is attached to the COM port is sujected to a specific Baudrate, parity, databit and stopbit, whose values i do not know beforehand. so i send the command for all combinations of baudrate, parity, databit stopbits.
You actually mean that you have no idea, and cannot predict, what settings the device uses on start up? I find that very hard to believe, because it means that the device is uninitialized and hence should not be able to communicate at all.
Usually a device that supports multiple communication settings starts off with a known configuration; e.g 300 baud, 1 stop bit, no parity. Then the host negotiates with the device about a new configuration through a known protocol.
If you don't know anything about this device, you would be better off using an oscilloscope to find out what configuration is used.
But even if you find out what configuration is being used, you still have to know the protocol, which I suspect can be found at the same place as where the communication settings are documented.
The alternative is to set a timeout using ::SetCommTimeouts() to let the timeout of the read operation expire when the hardware hasn't received a new byte within e.g. ten byte times. Then it's reasonable to assume that you've received all data the device wants to send and you can continue and try another configuration.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Sorry u are misunderstanding me !
Actually in my application i have an option to change the baudrate, parity, stopbit, databit of the device connected as well as to change the baudrate, parity, stopbit, databit of the COM port.
now lets assume one of the user have changed the device baud rate to 115200, with even parity, 6 databits 2 stopbits.
now i donot know the configuration of the connected device, so i have to change my COM port settings and send command for all combinations of baudrate, parity etc in order to communicate with the device.
when i get the correct/expected response i can conclude that this is the combination of the device!
i am also using CommTimeOuts !
Thanks !
|
|
|
|