|
ok it worked fine...
just wanted to ask you an other thing
suppose i have a key in the registry called "MyKey" and i have binary values each of them is called "MyVal"
i want to enumerate those values and read into my struct these values
i saw in the MSDN there is a method called "KeyEnum
DWORD dwType = REG_BINARY;
DWORD dwSize = sizeof(stMyStruct);
DWORD dwIndex(0);
DWORD dwValSize = 6; // size of MyVal
while (ERROR_NO_MORE_ITEMS != RegEnumValue(hKey,dwIndex,
_T("MyVal"),&dwValSize,0,&dwType,(LPBYTE)pInfo,&dwSize))
{
AddNewInfo(pInfo);
}
problem is i get an assert using this code...
can u help again?
thanks
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
You need to read the MSDN docs for this functiona a bit more carefully. This function is used to enumerate the values in a key, so passing in the value (MyVal) in your case, makes no sense.
|
|
|
|
|
right again! silly approach...
so suppose i have this entry:
key in registry is MyKey under it there can be one or more values named MyVal
each of them is a REG_BINARY value which represent my struct...
how can i enumerate all of them?
thanks for all the help
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
YaronNir wrote:
key in registry is MyKey under it there can be one or more values named MyVal
This is what's confusing me - in any key in the registry, there can only be on entry with a particular name. You can't have two values both named MyVal under the same key.
|
|
|
|
|
i've told you wrong, my bad....
i've manage to read all the values (enumerate) under the MyKey key...
they appear as MyVal1 MyVal2 etc.....
using the RegEnumValue did the trick!
thanks for all the help
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
In addition to the answer from Graham Bradshaw, I would like to make another comment.
You assume that your struct is 64 bytes. That might be an incorrect assumption, since it depends on how you set "struct member alignment" in Visual Studio.
Default is 8 bytes, so if you haven't changed it, your assumption is wrong, your struct isn't 64 bytes.
Use sizeof(stMyStruct) to get the real size!
|
|
|
|
|
thanks for the comment!
i did use sizeof and print to you the result (64!)
thanks anyway
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
hi, all
this app will get access violation at the end of the
void CSurchrgDlg::Exit()
{
if( !m_bCanceled )
{
m_theApp.AddRptText ("Add Surcharge finished successfully");
}
CDialog::OnCancel();
}
but if I run the exe from command promt, it will work and create the right report, I am not sure why it would get any error over command promt, even is debug version of exe. and why would the access violation show up at the end of exit function, seems like there is nothing to access at this point. Thanks for your time
|
|
|
|
|
Hi
I have one CString strData with data and i want to send it on to the server in Chunk of 500 Bytes only.Please tell me how can i do that. Right now i am sending it as whole. here is the code
strData = _T("Data=") + URLEncode2(strData);
pHttpFile->AddRequestHeaders(strHeaders);
pHttpFile->SendRequestEx(strData.GetLength());
pHttpFile->WriteString(strData);
Thanks
Shailesh
|
|
|
|
|
Why not use something like:
int x = 0;
do
{
CString strSend = strData.Mid(x, 500);
x = x + 500;
} while (! strSend.IsEmpty());
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
While going into loop it throws the exception at
strSend = strData.Mid(x,500) after going into loop 2 or 3 times . May be it is reached at the end of strData.
Any Suggestion
Thanks
Shailesh
|
|
|
|
|
Stepping into the call to CString::Mid() that asserts would have revealed the problem (hopefully). If the length of the string at point x is less than 500, ...
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
hi.
i want send a binery file to microcontrol(flash).
please help me
|
|
|
|
|
Did you ask at your local post office ?
|
|
|
|
|
hey! u got a vote! cheers!.. BTW who did that?
V
|
|
|
|
|
hi
i want send a binery file to micro control(flash).
please help me.
|
|
|
|
|
you need to eloborate on this. What micro controler and what kind of binary file. binary file is the firmware or just data
|
|
|
|
|
Hello, I need some suggestions from a GPS-hare!
I am starting to implement GPS into my app, which is running same time as a navigation system is running, thus it has to share the gps port, whatever it is made of (serial, bluetooth, usb and so on).
I saw one can use the commercial solution "Franson GPS Gate", which provides "virtual ports" by taking the original signals and then forwards them to its emulated ports.
So here is my first question:
Is there any way to emualte such a port myself, i mean, grab the signal from the port and provide a virtual port from within my app, so the navi-soft gets its signal from MY app?
And another question I have: Can anyone suggest some mfc classes encapsulating the NMEA protocol?
Thank you very very much!
Martin
|
|
|
|
|
I'm having a bit of a problem getting the handle to my listview. Can anyone suggest how I would pass this so that I can get the listview text and compare?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
I am not that experienced but as far as i know you have to pass a callback funtion as parameter:
i have done it useing mfc so zou have to translate that somewhat, this is the member function i declared as member of my derived listview, this example is used to sort numeric columns:
static int CALLBACK CallbackSortNumeric(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
Then, when you add a column, you have to pass the adress of the function (PFNLVCOMPARE pCALLBACKSORT):
this->InsertColumn(nCol, cHead,pCALLBACKSORT,iSortMode,iFormat, nWidth,nSubItem);
This way the sorting is managed in CallBackSortNumeric.
Hope it helps...
Martin...
|
|
|
|
|
ClockDivider wrote:
I am not that experienced but as far as i know you have to pass a callback funtion as parameter:
Yeah I did that. My problem is that in my callback I need to access the window handle and I cannot. I get a compiler error:
illegal reference to data member 'FileTransfer::hWnd' in a static member function
Here is my callback code:
<br />
int CALLBACK FileTransfer::ListViewCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)<br />
{<br />
static LV_FINDINFO fi;<br />
static int nItem1, nItem2;<br />
static char szBuf1[30], szBuf2[30];<br />
<br />
fi.flags = LVFI_PARAM;<br />
fi.lParam = lParam1;<br />
<br />
nItem1 = ListView_FindItem(hWnd, -1, &fi);<br />
<br />
fi.lParam = lParam2;<br />
<br />
<br />
return 0;<br />
}<br />
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
I am not sure why but here is some code i have in my function that might belong to the problem:
int CALLBACK CListCtrlEx::CallbackSortString(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
// lParamSort contains a pointer to the list view control.
CListCtrlEx* pListCtrl = (CListCtrlEx*) lParamSort;
}
Thus you should be able to convert lParamSort to a CWnd* which then provides the propper m_hWnd
Is that true?
|
|
|
|
|
The problem with this is that I'm not using any MFC.
Here is my event code:
<br />
LPNMLISTVIEW lpNmlv = (LPNMLISTVIEW) lParam;<br />
<br />
case LVN_COLUMNCLICK:<br />
if (lpNmlv->hdr.hwndFrom == GetDlgItem(hWnd, IDC_LOCAL_FILELIST))<br />
{<br />
ListView_SortItems(lpNmlv->hdr.hwndFrom, ListViewCompareProc,(LPARAM)(lpNmlv));<br />
}<br />
<br />
if (lpNmlv->hdr.hwndFrom == GetDlgItem(hWnd, IDC_REMOTE_FILELIST))<br />
{<br />
HWND RemoteHwnd = GetDlgItem(hWnd, IDC_REMOTE_FILELIST);<br />
}<br />
return TRUE;<br />
<br />
<br />
int CALLBACK FileTransfer::ListViewCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)<br />
{<br />
static LV_FINDINFO fi;<br />
static int nItem1, nItem2;<br />
static char szBuf1[30], szBuf2[30];<br />
NMLISTVIEW *lpNmlv = (NMLISTVIEW*)lParamSort;<br />
<br />
fi.flags = LVFI_PARAM;<br />
fi.lParam = lParam1;<br />
<br />
nItem1 = ListView_FindItem(lpNmlv->hdr.hwndFrom, -1, &fi);<br />
<br />
fi.lParam = lParam2;<br />
nItem2 = ListView_FindItem(lpNmlv->hdr.hwndFrom, -1, &fi);<br />
ListView_GetItemText(lpNmlv->hdr.hwndFrom, nItem1, lParamSort, szBuf1, sizeof(szBuf1));<br />
ListView_GetItemText(lpNmlv->hdr.hwndFrom, nItem2, lParamSort, szBuf2, sizeof(szBuf2));<br />
<br />
if (lpNmlv)
return(strcmp(szBuf1, szBuf2));<br />
else<br />
return(strcmp(szBuf1, szBuf2) * -1);<br />
<br />
}<br />
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Ummm... Your code compiles here...
But you already changed the calling of the ListView_FindItem and ListView_GetItemText, now using the lpNmlv.>hdr.hwndFrom, no?
What is the exact compiler error?
|
|
|
|
|
Yeah it compiles fine now. Just still not getting anything. I think I'm not setting my pointers correctly or the NMLISTVIEW struct.
You know there aren't very many samples of how to use this out there on the internet. Must be used much.
Tom Wright
tawright915@yahoo.com
|
|
|
|