|
James R. Twine wrote: N.B. You can pass a NULL to get information on the current module - this is how code in an EXE can get the location of the EXE. I do not know if you call that from within the DLL if you will get the path of the DLL or the hosting EXE, but it might work...
If GetModuleHandle(NULL) is called from a DLL the HMODULE of the hosting EXE is returned.
Steve
|
|
|
|
|
Well, that answers my question about not knowing which would be returned...
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Here's a function that will return the HINSTANCE of the module it's compiled into:
HINSTANCE GetMyModuleHINSTANCE()
{
MEMORY_BASIC_INFORMATION mbi;
DWORD res = VirtualQuery(&GetMyModuleHINSTANCE, &mbi, sizeof(mbi));
if (res!=sizeof(MEMORY_BASIC_INFORMATION))
{
return NULL;
}
return reinterpret_cast<HINSTANCE>(mbi.AllocationBase);
}
Note that there are better ways of doing this, depending on what framework you're using or if you've got access to DLLMain if you're a DLL or WinMain if you're an EXE. This code works without having to make any such assumptions however.
Steve
|
|
|
|
|
I have function
int lib(unsigned char *buf, unsigned short int **data)
//returining value of data
data[i][j] = ((buf[index]<<8) | buf[index+1]);
Now I am passing buffer(which contains some values) from the same above function like that.
unsigned short int actual_data[10][10];
if ((rval= lib(buffer, actual_data)) == -1)
It gives segments fail error ..plz guide me ..i think some prb with actual_data argument..
Thanks
|
|
|
|
|
you have to pass the matrix dimensions as function parameters too, otherwise, how can the function know where to stop ?
the segmentation error is a very classic error of a buffer overflow (you're writing over the end of your array)
[edit]What's wrong with this answer mister the "anonymous 1-voter" ??? can't you even justify your vote ? [/edit]
|
|
|
|
|
thx..but still same error ...Actually I want to pass pointer to 2d array..
if ((rval= lib(buffer, actual_data[10][10])) == -1)
|
|
|
|
|
did you tried to understand my reply ?
how is the pointer used then within the lib() function ?
you have to find where the buffer is overflown, and fix this !
|
|
|
|
|
How to do connection of VC++ with the database MS-SQL
Gorsia
|
|
|
|
|
There are scores of Database related articles for C++ here on CodeProject... take a look at them.
led mike
|
|
|
|
|
hi
I have seen programs that bind a DataGrid to an ADO Data Control.
But i want to know, how can i display the fields in Edit Controls.
Is there some way to bind the Edit control to the DataSource(ADO Control).
thx Slipnit
|
|
|
|
|
slipnit wrote: Is there some way to bind the Edit control to the DataSource(ADO Control).
This is the MFC/C++ forum. MFC classes and IDE wizards produce entire data input forms for you based on a database connection which includes using RFX (Record Field Exchange) macros to transfer data between user controls and your data source (data binding). There are mountains of information and examples on msdn.microsoft.com and of course in articles here on CodeProject.
led mike
|
|
|
|
|
hi
thx.its using RFX macros.
thx slipnit
|
|
|
|
|
|
Alright, I feel stupid. In VC6, radio button groups were handled through a single integer value. I can't find anything similar in VS2005. When I try to add a variable for a radio button, it insists on using a bool/BOOL value instead of an integer. What am I doing wrong?
"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
|
|
|
|
|
John Simmons / outlaw programmer wrote: What am I doing wrong?
Um, using VS2005?
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Well, I was hoping someone could provide me with something a bit less obvious.
"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
|
|
|
|
|
Unfortunately, in VS 2005 you have to add the DDX_Radio entries manually to DoDataExchange.
|
|
|
|
|
This must be one of the super-secret ways they're not abandoning support for C++/MFC developers...
"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
|
|
|
|
|
John Simmons / outlaw programmer wrote: This must be one of the super-secret ways they're not abandoning support for C++/MFC developers...
Apparently, this is by design. It's a reported issue - but they are not going to fix it[^]
Thnaks for reporting this problem for us. The behavior that you're refernig to however is by design. We only add DDX_... macros to the DoDataExchange method if the variable is marked as a 'Control variable'. What you probably want to do is to change 'Category' from 'Control' to 'Value'. With that you will get the appropriate things added to the DoDataExchange method.<br />
Regards,<br />
The Visual C++ Team
|
|
|
|
|
Even they're comment is incorrect. You won't get an int variable by changing the category.
If a bunch of programmers don't like the way it works, they should change it because their view is obviously f***ed up.
"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
|
|
|
|
|
I am not even seeing the behavior described by the bug. May be it got fixed in VS2005 SP1.
|
|
|
|
|
That's not true. It works.
|
|
|
|
|
It works for me. (Regardless of the fact that BOOL == int) you can type over the Variable Type field as shown in the image. As I cannot use img tag, I have uploaded the image here.
Radio.JPG (46.7 Kb)
And No, you don't have to add DDX_Radio manually.
|
|
|
|
|
Hi all,
I am writing one application using VC++.NET. Is it possible to get co-ordinates of HDC without knowing its associated HWND?
Thanks in Advance.
|
|
|
|
|
Do you mean the dimensions of the window?
GetViewportExtEx()/GetWindowExtEx()
Mark
|
|
|
|