|
No i need to draw gray when i leave the row selected but i click on another control.
|
|
|
|
|
Right. In that case the other control has the focus, not the list control. Note, that this is different than a row within the list control having the focus state.
Your code for that could look something like this (I did not try to compile it so there might be errors):
case CDDS_ITEMPREPAINT|CDDS_SUBITEM:
{
if (::GetFocus() != m_MainTable.m_hWnd)
{
pCD->clrTextBk = RGB(192, 192, 192); *pResult = CDRF_NEWFONT;
}
else
{
if (m_MainTable.GetItemState(nRow, LVIS_SELECTED)==LVIS_SELECTED && m_MainTable.GetItemState(nRow, LVIS_FOCUSED)==LVIS_FOCUSED)
{
pCD->clrTextBk = RGB(167,205,240); *pResult = CDRF_NEWFONT;
}
if (m_MainTable.GetItemState(nRow, LVIS_SELECTED)==LVIS_SELECTED && m_MainTable.GetItemState(nRow, LVIS_FOCUSED)!=LVIS_FOCUSED)
{
pCD->clrTextBk = RGB(197, 206, 216); *pResult = CDRF_NEWFONT;
}
}
break;
}
Soren Madsen
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
|
|
|
|
|
You are a MASTER!!!! you solved me the problem THANKS THANKS!!!!
|
|
|
|
|
|
Hi everyone,
I am currently trying to read the following registry key in one of my programs:
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName
I need to find out whether automatic logon is enabled on a machine or not, and reading whether above setting is empty or not seems to be the best way to do this. However, querying the value simple returns an empty string (though it definitely isn't empty); the code is working, as it works fine with other keys. So I guess that my program, for whatever reason, cannot access the Winlogon keys (other keys also don't work).
Is there any workaround for this? Or any other way to find out if autologon is enabled? Hope anyone can shed some light on this, as it is driving me nuts right now
I couldn't really find a better forum for this question; at least the program is written in C++, so...
http://www.renderpal.com
http://www.shoran.de
|
|
|
|
|
Daniel 'Tak' M. wrote: as it works fine with other keys.
Daniel 'Tak' M. wrote: (other keys also don't work).
Which is it?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
The code works with other keys which are _not_ in Winlogon. Like HKLM\Software\Microsoft\Windows NT\CurrentVersion\Ports (read COM1:, retrieved the correct string).
http://www.renderpal.com
http://www.shoran.de
|
|
|
|
|
OK. You might want to post the code you are using. Maybe we can see something wrong with it.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Here it is (pretty straightforward):
HKEY hKey;
if (RegCreateKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ, NULL, &hKey, NULL) == ERROR_SUCCESS)
{
BYTE lpBuffer[1024];
DWORD dwType;
DWORD dwBufferSize = 1024;
if (RegQueryValueEx(hKey, "DefaultUserName", 0, &dwType, lpBuffer, &dwBufferSize) == ERROR_SUCCESS)
{
...
}
}
The query succeeds, but the buffer is simply empty (though the setting isn't); if I change Winlogon to "Ports" and the key name to "COM1:", I get the correct value.
http://www.renderpal.com
http://www.shoran.de
|
|
|
|
|
Are you working with the 32 or 64 bit version of Windows?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
64 bit; the program is 32 bit, though.
http://www.renderpal.com
http://www.shoran.de
|
|
|
|
|
That might be the problem.
Try calling RegCreateKeyEx as such:
RegCreateKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WOW64_64KEY, NULL, &hKey, NULL)
Use the KEY_WOW64_64KEY flag to indicate that you want to open the 64-bit view of the key.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
That did it! You really saved my day, Richard. My MSDN docs don't include that extra flag (VS 2005 still...), so I didn't know about it.
http://www.renderpal.com
http://www.shoran.de
|
|
|
|
|
Glad I could help.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Hi,
I've been using MFC Dev Studio 97 with VC 5++, MFC 42, etc for near 20 years, and it does exactly what I want it to do. In other words, I have absolutely no reason to fork out for an upgrade. The compiler and Wizards works fine under Windows 7.
One problem is that Win7 does not pass the 'Genuine Windows' test as soon as the program is installed on a Win7 computer. I know it is no longer supported. That however does not make it illegal to use! I paid big money for it at the time!
Another problem is, that the Help System fails to display anything. That started with XP SP 2, which could then be fixed with a Registry Setting relating to MK_PROTOCOL. XP-SP3 stripped away more help files.
At the moment, we have several Win98 computers running just to access the Help Files.
However There must be a better solution.
Regards,
Bram.
Bram van Kampen
|
|
|
|
|
Hi,
I am new in development and I need some help and I'll greatly appreciate your help. We have deployed a kit which is scanning wifi and and bluetooth devices and storing them into the device's local database (device is linux debian) with smartphone's ID and other stuff. My first task is to write a c or c++ program which can parse those received frames and format them according to our own database and then send it in xml format to our own event handler which will eventually send it to our database.
Thank you very much in advance looking forward for your response.
Kind regards
|
|
|
|
|
I want to write a code which can parse the received frames from the device to an xml file and send it to our database. I broke that task into pieces and first is to write that proram to parse any file into an xml format but it will be my first time so I don't know how to start or can I use an API for that some samples would be great.
Thank you in advance.
|
|
|
|
|
Member 10125032 wrote: I broke that task into pieces and first is to write that proram to parse any file... Do you have code to read this file? That would be a good starting point. Until you get past this, XML and database stuff are irrelevant.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
You can use XmlLite[^] to write simple XML data.
|
|
|
|
|
Member 10125032 wrote: We have deployed a kit ...My first task is to write a c or c++ program which can parse those received frames and format ... in xml format to our own event handler
Steps
- Get the spec for the 'kit' to determine what it stores.
- Read the data.
- Parse it according to what you learned from the spec. It is unlikely that any complex solutions would be required for this (hopefully, but the spec is the source.)
- The parser will create an internal format (list of structs probably) of your own devising. Probably very close to what you want to put into the xml.
- Determine what the xml looks like. Either find out what it already expects. Or design it. If the latter then someone needs to tell you what data they expect. Otherwise you have no idea what you need to get.
- Write the internal format out to xml form based on the previous step.
|
|
|
|
|
Hi all
I am writing a program to submit some files in a SQL server 2012 the problem is:
when the file size is around 255 KBytes it's all ok, but when the file is greater there is an error on "RecordSet.Update() phase. The error is : "The Pointer Value type Text, NText or image conflicts with the specified column name. ..."
The Column is declared in table as varbinary(max) the code is:
CFile file(szPathFileToOpen, CFile::modeRead);
ULONGLONG filelen = file.GetLength();
rsAttachments.AddNew();
rsAttachments.m_AttachmentsID=szUniqueID;
rsAttachments.m_FileName=m_ListAttached.GetItemText(0,0);
GlobalFree( rsAttachments.m_FileData.m_hData );
if((rsAttachments.m_FileData.m_hData=GlobalAlloc(GMEM_MOVEABLE,filelen))==NULL)
{
AfxMessageBox(_T("memory error"));
}
LPVOID pVoid = NULL;
if((pVoid=GlobalLock(rsAttachments.m_FileData.m_hData))== NULL)
{
AfxMessageBox( _T( "memory error" ));
}
file.Read(pVoid, filelen);
rsAttachments.SetFieldDirty( &rsAttachments.m_FileData, TRUE );
rsAttachments.SetFieldNull( &rsAttachments.m_FileData, FALSE );
rsAttachments.m_FileData.m_dwDataLength=GlobalSize(rsAttachments.m_FileData.m_hData );
rsAttachments.Update();
GlobalFree( rsAttachments.m_FileData.m_hData );
Thanks in advance to the angel will help me.
Giovanni
|
|
|
|
|
Where is the code that raises the error and what are the values of the parameters being referenced?
|
|
|
|
|
i am a novice with a DB programming i have put now a CDBException that return me this:
m_strStateNativeOrigin = "State:37000,Native:7125,Origin:[Microsoft][ODBC SQL Server Driver][SQL Server]
State:S1000,Native ,Origin:[Microsoft][ODBC SQL Server Driver]
It's good this?
|
|
|
|
|
Sorry, that means nothing. You need to show the exact code that causes the error, and include the values of all the parameters being used.
|
|
|
|
|
Ok already posted the code the problem occur in the moment i call Update, and when the file is greater than 255kb
|
|
|
|