|
the function dec i use:
extern "C" int __declspec(dllexport) __stdcall MakeQuery (long nUseAvailable,DWORD searchjob_id,DWORD search_id,DWORD user_id);
the function def line:
int __declspec(dllexport) __stdcall MakeQuery(long nUseAvailable,DWORD searchjob_id,DWORD search_id,DWORD user_id)
the vb module entry:
Public Declare Function MakeQuery Lib "qdbprint.dll" _
Alias "_MakeQuery@16" (ByVal uservailable As Long, ByVal SearchJobID As Long, ByVal search_id As Long, _
ByVal user_id As Long) As Integer
hope this helps
---
"all's fair in love and war but in love there is no geneva convention"
|
|
|
|
|
why ;
Alias "_MakeQuery@16"
do u have to include this?
Confusios say "Man who run in front of car get tired, Man who run behind car get exhausted."
|
|
|
|
|
it lets u use MakeQuery (in the example) instead of _MakeQuery@16 (which i believe is an illegal name in vb)
the @16 bit comes from the number of params u pass ... generally it seems to be 4 bytes per param
if you do it like this it will work
---
"all's fair in love and war but in love there is no geneva convention"
|
|
|
|
|
ok, I change my VB declaration:
Public Declare Function CVDDLL_Main Lib "cvddllmain.dll" Alias "_CVDDLL_Main@16" (ByVal sFile As String, _
ByVal iLen As Integer, _
ByVal sFileDesc As String, _
ByVal sErrorLog As String) As Integer
my c declaration still is:
#define CEEPROGS
extern "C" // need for 'C' & VB progs
{
#ifdef CEEPROGS
__declspec(dllexport) int CVDDLL_Main(char *Src,int Srclen,char *DestName,char *ErrorLog);
#define OURCALLING __declspec(dllexport)
#else
int APIENTRY CVDDLL_Main(char *Src,int Srclen,char *DestName,char *ErrorLog);
#define OURCALLING APIENTRY
#endif
}
but now i get this error:
Can't find DLL entry point _CVDDLL_Main@16 in cvddllmain.dll
Confusios say "Man who run in front of car get tired, Man who run behind car get exhausted."
|
|
|
|
|
ummmm
i dont see your __stdcall bit anywhere?
---
"all's fair in love and war but in love there is no geneva convention"
|
|
|
|
|
OHHHH!!!! THANKS YOU!!!!
/me very happy now.
)
))
thanks again for all you help. works like a bomb now!
Confusios say "Man who run in front of car get tired, Man who run behind car get exhausted."
|
|
|
|
|
Hi,
I have a pointer to an XMlDomDocument, and I would like to have an exactly the same copy of that DomDocument in to another XMLDomDoc ( the content, not the adress), I guess maybe is not so correct to think that with a copy constructor I will have it all solved ( or yes ?).
one *bad* idea about doin that is: get the XML string, and tell the other instance to generate the XML doc from that string... what that would be not very.... optimal...
Can you help me ?, Thanks in advance, Greetings
Braulio
|
|
|
|
|
It has a clone method, or at least the nodes do, so grab the top level node, and clone it when you insert it into a new document.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
Mmm... but I´m afraid that it doesn´t work for the root node..
Thanks !
Braulio
|
|
|
|
|
Now I have a trouble with my project.
In my application, I want to send a byte to hardware port, example a address of printer port but I don't know how to do. Please help me!
Thanks!
TP
|
|
|
|
|
Take a look at the CreateFile() function. You can use this to open any kind of device. In the case of the printer port you would use something like:
HANDLE hLPTA = CreateFile("LPT1", ...) ;
You will then be able to use
ReadFile/WriteFile(handle) to send / get datat from the port.
Unfortunately, I dont have a full example on how to open the printer port, but I can give one for a serial port, with all the configuration calls.
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
A fool jabbers, while a wise man listens. But is he so wise to listen to the fool?
|
|
|
|
|
hi,
i posted a message yesterday but have not responses, and reading i thinks it's no well explained my doubt.
i have a managed class CNotificacionNet and unmanaged class CUNotificacionNet.
this is unmanaged code
#include "NotificacionNet.h"
class CUNotificacionNet : CFVNotificacion
{
public:
CUNotificacionNet(void);
~CUNotificacionNet(void);
sofianet::CNotificacionNet * m_pNotifiacion;
bool SetManagedNotifiacion(sofianet::CNotificacionNet*);
};
but when i build my project i recived this error:
c:\sofianet\UNotificacionNet.h(15): error C3265: cannot declare a managed 'm_pNotifiacion' in an unmanaged 'CUNotificacionNet'
any ideas to do it?
Thanks in advance
Salamanca 2002 Capital Cultural Europea, Visitala
|
|
|
|
|
I've been doing a lot of searching for this one, but finally struck gold in MSDN's C++ ME migration guide:
String * sTest = S"This is a test";
char __nogc* pcString = static_cast<char*>(Marshal::StringToHGlobalAnsi(sTest).ToPointer());
Just curious if many people are using this, or if there are other good methods to copy a managed string to an unmanaged char array.
|
|
|
|
|
For building an editor I'd need to know to how to create windows metafiles myself, and how to save them in the end.
Are there some free SDKs or are there already some solutions for pure MFC?
Thanks in advance,
Roland
|
|
|
|
|
Hi,
Just one thing, WMF files are old technology ( Win 3.1 legacy...), if you can choose what to use, rather use EMF files ( Enhanced Metafiles), for more info take a look at the API functions:
CreateEnhMetafile
PlayEnhMetafile
But if you need WMF support, you will find on MSDN lot of info about that as well.
One example about EMF ( load from resources and EMF, and show it in an MFC app, and ATL DLL), you can find it in:
http://www.codeproject.com/atl/PictureTransfer.asp
HTH
Braulio
|
|
|
|
|
Hi, i need to create a virtual serial communication port on windows2000/XP.
This port should be used by normal application program. This port communicate with any windows program that required serial com, and with my program that rules a virtual serial com.Who help me?
Eng. Giuseppe Peschiera
|
|
|
|
|
Hi:
I encount such codes, plz explain them in detail. Thank you in advance.
typedef unsigned (WINAPI *PBEGINTHREADEX_THREADFUNC)(LPVOID lpThreadParameter);
typedef unsigned *PBEGINTHREADEX_THREADID;
Best regard.
I confess that I am a stubborn guy, but why not put things thoroughly, logically and systematically clean. One concrete prolem is worth a thousand unapplied abstractions.
|
|
|
|
|
A typedef allows a new parameter to be created, it's more intelligent than a macro ( I believe ) but does the same sort of thing in effect. In this case, for example, PBEGINTHREADEX_THREADID is the same as an unsigned (int) pointer.
The reason to do this is that the type you use through your code for something specific can be changed just by changing the typedef.
I've never found a use for them, so if anyone else contradicts me, believe them first
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
so my answer could be wrong?
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
I thought my answer might be a little more expansive, but I didn't think yours was wrong.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
Of course!
And I just wanted to know if I was wrong about that point!
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
I have used this kind of typedef in the past. Usually when I have loaded a DLL dynamically, and you nned to store function pointers to the return calls from GetProcAddress. This allows you to save the pointers in member vars and call them like function of a regular class once the pointers are correctly initialised.
For example:
typedef int (*DLLINIT)(int x);
typedef void (*DLLEXIT)() ;
class DLLWrapper
{
DLLINIT DLLInit;
DLLEXIT DLLExit ;
HINSTANCE hInstance ;
DLLWrapper(CString& filename)
{
DLLInit = NULL ;
DLLExit = NULL ;
hInstance = NULL ;
LoadDll(filename) ;
} ;
~DLLWrapper()
{
if (hInstance)
FreeLibrary(hIstance) ;
hInsatnce = NULL ;
}
bool LoadDLL(CString& filename)
{
hInstance = LoadLibrary(filename);
if (!hInstance)
return false ;
DLLInit = (DLLINIT)GetProcAddress(RefinementDLL.pDLL, "DLLInit");
DLLExit = (DLLEXIT)GetProcAddress(RefinementDLL.pDLL, "DLLExit");
return true ;
}
} ;
DLLWrapper fred("Some.DLL") ;
fred.DLLInit(1) ;
That lot was put together quickly, so it may not all be 100% correct.
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
A fool jabbers, while a wise man listens. But is he so wise to listen to the fool?
|
|
|
|
|
NicholasCougar wrote:
typedef unsigned (WINAPI *PBEGINTHREADEX_THREADFUNC)(LPVOID lpThreadParameter);
function pointer
NicholasCougar wrote:
typedef unsigned *PBEGINTHREADEX_THREADID;
a typedef of a unsigned!
A typedef is a way to make your own names of types in C++. And sometimes "makeing" your own types...
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
Hi,
the first defines a pointer to a function that takes a void pointer as parameter and returns an unsigned. The second simply defines PBEGINTHREADEX_THREADID to be a pointer to an unsigned.
You probably got this from the CreateThread API, right?
You know, for kids!
|
|
|
|
|
The codes are from Multithreading Applications in Win32 written by Jim Beveridge & Robert Wiener
First, please study the second and sixth parameters.
unsigned long _beginthreadex(
void *security,
unsigned stack_size,
unsigned (* start_address)(void *),
void *arglist,
unsigned initflag,
unsigned *thrdaddr);
HANDLE CreateThread(
LPSECURITY_ATTRIBUTES lpThreadAttributes,
DWORD dwStackSize,
LPTHREAD_START_ROUTINE lpStartAddress,
LPVOID lpParameter,
DWORD dwCreationFlags,
LPDWROD lpThreadId);
According to Jim Beveridge & Robert Wiener' point of view, the function _beginthreadex() is the coat of CreateThread() and the types of its parameters have been changed for the sake of being adoptable to other operation system. While, as the CloseHandle() must be called at last, programmers can't get rid of "window.h". Another side effect is, though C compiler makes no difference between DWORD and unsigned (in fact unsigned int), C++ compiler doen't think so.
As CreateThread() is inside _beginthreadex(), its parameters are less likely to be modified. Defining parameters according to CreateThread() is smarter. Since the parameters must be accepted by _beginthreadex(), the codes we discussing must appear there. The true meaning of the codes is: force type convertion before calling _beginthreadex().
the following are codes in all:<may jim="" and="" robert="" can="" forgive="" me,just="" for="" discussion="">
//The beginning of codes
#define WIN32_LEAN_AND_MEAN
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <process.h>
typedef unsigned (WINAPI *PBEGINTHREADEX_THREADFUNC)(
LPVOID lpThreadParameter
);
typedef unsigned *PBEGINTHREADEX_THREADID;
int main()
{
HANDLE hThread;
DWORD dwThreadId;
int i=0;
hThread = (HANDLE) _beginthreadex(NULL,
0,
(PBEGINTHREADEX_THREADFUNC)ThreadFunc, // Attention, Plz
(LPVOID) i,
0,
(PBEGINTHREADEX_THREADID) & dwThreadId // Attention, Plz
);
if(hThread)
{
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread);
}
return EXIT_SUCCESS;
}
DWORD WINAPI ThreadFunc(LPVOID n)
{
// Do something...
return 0;
}
//The end of codes
My opinion is, to be a best programmer, one should no only learn how to coding, but methodology inside as well. It's not for kids, its for a true programmer.
Best regard.
I confess that I am a stubborn guy, but why not put things thoroughly, logically and systematically clean. One concrete prolem is worth a thousand unapplied abstractions.
|
|
|
|
|