|
I meant that, if i will create my DSN in ODBC Administrator in my computer, I sure that in another computer will be another DSN.
Bu t I've already done with my problem. I got ODBC connection,using connection string. I understood my error. It's necessary after "DBQ=" in connection string to write path of folder, not of file.
|
|
|
|
|
Jackson86 wrote: It's necessary after "DBQ=" in connection string to write path of folder, not of file.
That must be a dBase thing. I used the following for a DSN-less connection to an Access database:
"ODBC;Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\\somefolder\\dataaccess\\ADO\\nwind.mdb;"
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Yes, you are right. It's dBase thing. But it was main problem for me. ODBC interprets dBase database as folder, where dbf files are located, and dbf files as tables of this database.
|
|
|
|
|
Hi all:
I have the following codes:
<br />
typedef struct Point3Struct {<br />
double x, y, z;<br />
} Point3;<br />
...<br />
Point3 Object1_vertex[] = {...}<br />
...<br />
void someFunction(Point3 *vertex_list){<br />
size_t size = sizeof(vertex_list) / sizeof(Point3);<br />
...<br />
}<br />
<br />
int main(){<br />
someFunction(Object1_vertex);<br />
}<br />
By passing the vertex array into the function "someFunction", I want to calculate the size of the array and do some other operations. But why this doesn't work? When I trace the program, the varialbe size is always 0. And the vertex_list is just the first element of the array.
Other than that, if I try to do something like
size_t size = sizeof(Object1_vertex) / sizeof(Point3);
It will give me an error message saying that
error C2070: 'Point3 []': illegal sizeof operand
which complains about the "sizeof(Object1_vertex)".
How should I solve the problem please? If I want to pass an array into a function, is this the correct way to do that???
Asura
|
|
|
|
|
You'll simply need to pass the size of the array as a separate argument.
If you want to know more details on why this is happening, see this discussion[^], or search for "array decay" on the Internet.
|
|
|
|
|
size_t size = sizeof(vertex_list) / sizeof(Point3);
won't work since vertex_list is a pointer and its size is 4 (or 8).
This...
size_t size = sizeof(Object1_vertex) / sizeof(Point3);
...works for me (size == 3 if I initialize with 3 Point3 structs) but that makes passing the array
useless since the array is accessible from anywhere in the same file anyway.
You may need to pass the size along with the array pointer unless you can define the array with
a set size.
Mark
|
|
|
|
|
In addition to the previous answer, I suggest that you take a look at the container classes from the STL (std::list or std::vector for example). At first sight it might be more complicated but it solves a lot of problems (and finally ease your life because you won't need to manage the memory yourself).
|
|
|
|
|
Hi,
So I have this code to open a handle hKey which works fine.
RegCreateKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\MyProgram", 0L, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, NULL);
Then I try to set a value from a GUI CString member variable m_license_key into registry.
RegSetValueEx(hKey, "PROGRAM_KEY", 0L, REG_DWORD,(LPBYTE)&m_license_key, sizeof(DWORD));
The set function also works fine other than the fact that "rubbish" gets inserted as value for my registry key. In other words, HKEY_LOCAL_MACHINE\\SOFTWARE\\MyProgram\\PROGRAM_KEY is added, but the value is not what I keyed into m_license_key (it is just some strange text or some 0xHex numbers)
To be honest, I do not know what to specify for parameters 4, 5, 6 of RegSetValueEx. Any help would be greatly appreciated. Thanks.
|
|
|
|
|
I use this code...
bool CRegistry::SetKey(HKEY hKey, CString csSubkey, CString csValName, CString csVal)
{
if(hKey != HKEY_CURRENT_USER)
return false;
if(csSubkey.IsEmpty() || csValName.IsEmpty() || csVal.IsEmpty())
return false;
HKEY hWkKey;
LONG lRetorn = RegOpenKeyEx(hKey,csSubkey,0,KEY_ALL_ACCESS,&hWkKey);
if(lRetorn == ERROR_SUCCESS)
{
int iLength = csVal.GetLength();
lRetorn = RegSetValueEx(hWkKey,
csValName,
0,
REG_SZ,
(BYTE *)csVal.GetBuffer(0),
iLength);
RegFlushKey(hWkKey);
RegCloseKey(hWkKey);
if( lRetorn == ERROR_SUCCESS)
return true;
}
return false;
}
Hope this helps.
|
|
|
|
|
You can't cast a CString to a LPBYTE.
If you want the text in the CString saved then use the REG_SZ type...
RegSetValueEx(hKey, "PROGRAM_KEY", 0L, REG_SZ,(LPBYTE)(LPCTSTR)m_license_key, m_license_key.GetLength() + 1);
|
|
|
|
|
trumper wrote: I do not know what to specify for parameters 4, 5, 6 of RegSetValueEx.
They hide that information in the documentation[^]
led mike
|
|
|
|
|
led mike wrote: They hide that information
bastards
|
|
|
|
|
Thanks guys for all the help.
(BYTE *)m_license_key.GetBuffer(0) worked best for me =)
Really appreciate it.
|
|
|
|
|
How mean they do it to us
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
Using the 2.25 version in VS2005:
I have an OnNotify() function in my parent window, and I get the GVN_BEGINLABELEDIT message just fine, but I never see a GVN_ENDLABELEDIT message. What am I doing wrong?
[EDIT]
It seems the grid only fires the message if the text in the cell changes. I fixed it in my copy of the grid and posted the fix in the article comments.
[/EDIT]
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi All,
Is anyone aware of the handle count for a process in windows?
Please let me know if it require further clarification.
Suraj
Suraj Gupta
|
|
|
|
|
HandleCount property of a process refers to the number of operating system handles opened by that process. I suggest you ask such questions pertaining to .NET stuff in the .NET Framework Forum.
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
Is there any limit to that number...
Suraj Gupta
|
|
|
|
|
|
Why is that a .net specific question ?
The original poster did not mentionned the HandleCount property at all in his post.
|
|
|
|
|
That person has edited his post! He had asked what HandleCount was. Hope you understand it.
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
Hi
The Handle count for a process is the total of handles used: Thread, opened files, events.
I think u know that the function to get HC is GetProcessHandleCount.
U have to be carefully if your app have HC that never decreases
Regards
David Leyva
|
|
|
|
|
And also except handle count we have thread count
|
|
|
|
|
Thanks alot for your replies...
Handle count for a process is limited to 10000 and it can be increased to 18000 (max limit). But I can see different process on my machine (like explorer.exe) having handle count greater than 18000.
How that process is running properly even when handle count has increase dramactically?
Suraj Gupta
|
|
|
|
|
In a previous post I was attempting to "serialize" an HICON, i.e. save it as a blob in a file or database: the opposite operation to the ExtractIcon() operation. I have since learned how to do this (see routine below).
BUT now my problem is, this routine loses color information. When the routine is run against a true-color icon, and the buffer is saved as a .ico file, and the .ico file is reloaded with ExtractIcon(), the resulting icon has reduced to 256 colors.
I think this must be a limitation of OleCreatePictureIndirect(). How can I fix my routine?
------------------------------------------------
void SerializeIcon(const HICON icon, DWORD* size, BYTE** data)
{
LPPICTURE pPicture;
PICTDESC rPD;
rPD.cbSizeofstruct = sizeof(PICTDESC);
rPD.picType = PICTYPE_ICON;
rPD.icon.hicon = icon;
IStream* pStream = NULL;
HGLOBAL hMem = NULL;
BYTE* pMem = NULL;
long lActual;
OleCreatePictureIndirect(&rPD, IID_IPicture, FALSE, (void**) &pPicture);
CreateStreamOnHGlobal(0, TRUE, &pStream);
pPicture->SaveAsFile(pStream, TRUE, &lActual);
pPicture->Release();
GetHGlobalFromStream(pStream, &hMem);
pMem = (BYTE*) GlobalLock(hMem);
*size = GlobalSize(hMem);
*data = (BYTE*) malloc(*size);
CopyMemory(*data, pMem, *size);
GlobalUnlock(hMem);
GlobalFree(hMem);
}
------------------------------------------------
<div class="ForumSig">
cheers,
Neil</div>
|
|
|
|