|
All the answers leave many grins (and visions of fish fillets)
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I hear you brother. Will it run on "any PC"?
What would really be helpful is a Filet-O-Fish CD, you put it in "any PC" and the PC gives you a Filet-O-Fish sandwich.
led mike
|
|
|
|
|
led mike wrote: What would really be helpful is a Filet-O-Fish CD, you put it in "any PC" and the PC gives you a Filet-O-Fish sandwich.
I've been working on that, but I have doubt.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
send me the codes pleeeezzzzz it's ORGENT I'm hungry
led mike
|
|
|
|
|
led mike wrote: I hear you brother. Will it run on "any PC"?
What would really be helpful is a Filet-O-Fish CD, you put it in "any PC" and the PC gives you a Filet-O-Fish sandwich.
Maxwell Chen
|
|
|
|
|
It looks like there won't be an autorun.
|
|
|
|
|
nike_arh wrote: It looks like there won't be an autorun.
Don't say things like that! Think about the reactions on Wall Street!
led mike
|
|
|
|
|
You can statically link all the dependencies to a C++ program and run it from a CD. You can even choose not to link any run time libraries at all and make a "pure" Win32 program.
|
|
|
|
|
I'm attempting to work with PropertyGrids in Visual C++ for the first time, and I'm having difficullty figuring out how to change the Attributes. I want to change the Category as well as the Descriptions, but the only documentation I can find on this is for C#. According to that I'm suppose to use the [Description] and [Category] attributes before the property, but when I use them in C++ I get attributes not found error. I tried creating these as custom attributes but that didn't effect the grid. Is there another way to do this? Are there different attributes to use? Or is there some special Attributes library I've not included?
Thanks!
|
|
|
|
|
So if you are doing .NET development in C++ so C++/CLI you should be in the C++/CLI forum. This form is for C/C++ development.
Your problem could be that you have not referenced the appropriate assembly. The assembly needed is included in the documentation.
led mike
|
|
|
|
|
Hello
I have downloaded this code from the internet and I am trying to compile it. Howerver, I keep getting these 2 errors which I cannot seem to solve.
Error C2491 StartNativeProcessing definition of dllimport function not allowed
Error C2491 StartNativeProcessingWithControlProc definition of dllimport function not allowed.
Many thanks for any assistance with this code.
Steve
#ifdef NATIVEDLL_EXPORTS<br />
#define NATIVEDLL_API extern "C" __declspec(dllexport)<br />
#else<br />
#define NATIVEDLL_API __declspec(dllimport)<br />
#endif<br />
<br />
typedef void (CALLBACK *NATIVEWORKCOMPLETEPROC)();<br />
<br />
typedef BOOL (CALLBACK *NATIVEWORKCONTROLPROC)(LPARAM lParam);<br />
<br />
NATIVEDLL_API void StartNativeProcessing(NATIVEWORKCOMPLETEPROC workCompleteProc);<br />
<br />
NATIVEDLL_API void StartNativeProcessingWithControlProc(<br />
NATIVEWORKCONTROLPROC workControlProc, LPARAM lParam, NATIVEWORKCOMPLETEPROC workCompleteProc);<br />
<br />
#include "stdafx.h"<br />
#include "NativeDLL.h"<br />
#include <windows.h><br />
#include <commctrl.h><br />
<br />
BOOL APIENTRY DllMain( HANDLE hModule, <br />
DWORD ul_reason_for_call, <br />
LPVOID lpReserved<br />
)<br />
{<br />
switch (ul_reason_for_call)<br />
{<br />
case DLL_PROCESS_ATTACH:<br />
case DLL_THREAD_ATTACH:<br />
case DLL_THREAD_DETACH:<br />
case DLL_PROCESS_DETACH:<br />
break;<br />
}<br />
return TRUE;<br />
}<br />
<br />
NATIVEWORKCOMPLETEPROC g_workCompleteProc = NULL;<br />
NATIVEWORKCONTROLPROC g_workControlProc = NULL;<br />
<br />
const int workSleepTimeInMilliseconds = 1500;<br />
<br />
DWORD WINAPI ThreadFunc(void* pvThreadParam);<br />
void DoWork();<br />
<br />
NATIVEDLL_API void StartNativeProcessing(NATIVEWORKCOMPLETEPROC workCompleteProc)<br />
{<br />
g_workCompleteProc = workCompleteProc;<br />
g_workControlProc = NULL;<br />
<br />
DWORD dwThreadId;<br />
CreateThread(0, 0, ThreadFunc, NULL, 0, &dwThreadId); <br />
}<br />
<br />
NATIVEDLL_API void StartNativeProcessingWithControlProc(<br />
NATIVEWORKCONTROLPROC workControlProc, LPARAM lParam, NATIVEWORKCOMPLETEPROC workCompleteProc)<br />
{<br />
g_workCompleteProc = workCompleteProc;<br />
g_workControlProc = workControlProc;<br />
<br />
DWORD dwThreadId;<br />
CreateThread(0, 0, ThreadFunc, (void*)lParam, 0, &dwThreadId); <br />
}<br />
<br />
DWORD WINAPI ThreadFunc(void* pvThreadParam)<br />
{<br />
int loopControl = 0;<br />
<br />
do<br />
{<br />
DoWork();<br />
if (g_workControlProc != NULL)<br />
loopControl = g_workControlProc((LPARAM)pvThreadParam);<br />
}<br />
while(loopControl != 0);<br />
<br />
if (g_workCompleteProc != NULL)<br />
g_workCompleteProc();<br />
<br />
return 0;<br />
}<br />
<br />
void DoWork()<br />
{<br />
Sleep(workSleepTimeInMilliseconds);<br />
}
|
|
|
|
|
steve_rm wrote: #ifdef NATIVEDLL_EXPORTS
#define NATIVEDLL_API extern "C" __declspec(dllexport)
#else
#define NATIVEDLL_API __declspec(dllimport)
#endif
Why is export extern "C" but import not the same?
Regardless, the NATIVEDLL_API macro should be used only on the function declarations (prototypes),
not on the function definitions/implementations.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
have you #defined NATIVEDLL_EXPORTS anywhere?
|
|
|
|
|
Hello,
I got it working. However, I am not totally sure why.
Why did it work when I removed the NATIVEDLL_API from the function definitions, and what are the macros for?
Can you explain the code below?
Many thanks for you help,
Steve
<br />
#ifdef NATIVEDLL_EXPORTS<br />
#define NATIVEDLL_API extern "C" __declspec(dllexport)<br />
#else<br />
#define NATIVEDLL_API __declspec(dllimport)<br />
#endif
|
|
|
|
|
those let you create exports and imports from the same code base. when compiling the DLL, you use the export part, but when using the DLL, you use the import part.
it's standard DLL stuff that MS automatically creates for a DLL project.
|
|
|
|
|
I'm developing a game in win32 c++ DirectX.
On my graphic game window I have a picture of a 'close' button. When I click on it I want it to to the same as clicking the 'X' button.
But although I tried several things:
<br />
::SendMessage(hWnd, WM_CLOSE, NULL, NULL);
::SendMessage(hWnd, WM_DESTROY, NULL, NULL);
<br />
DestroyWindow(hWnd);
I get strange bugs that won't happen when I click 'X'.
|
|
|
|
|
PostMessage(WM_SYSCOMMAND,SC_CLOSE,0);
Best Wishes,
-David Delaune
|
|
|
|
|
Thank you very much.
It seems like all crazy bugs are gone.
|
|
|
|
|
Hanan888 wrote: ::SendMessage(hWnd, WM_DESTROY, NULL, NULL);
Don't do that! That doesn't destroy a window
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks.
I Really shouldn't post
::SendMessage(hWnd, WM_DESTROY, NULL, NULL);
as a real candidate.
I was pretty desperate when I posted that message...
|
|
|
|
|
hehe the last act of a desperate programmer
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
"He got sick of it. Sick of life, sick of people, sick of Win32. Desperate and dispirited, he code ::SendMessage(hWnd, WM_DESTROY, NULL, NULL); . And I can tell you this: whatever it does, it doesn't destroy a window..."
|
|
|
|
|
Excellent!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: Don't do that! That doesn't destroy a window
Opps, let me check how many windows has been destroyed by me till date!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
Huh? What are you talking about Alok?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|