|
hey, I am trying to send a variable from vb to vc6 dll, which will specify which adapter to open. The count for this machine, for instance, is 3. When the user selects a device from the list in VB, they click start and the VB app sends the corresponding number --lets say 2. Then the DLL receives the long variable and converts to u_int and shaves off one, so the value becomes 1. This value is then ran through a for loop, stopping on the device we want. This stores the name of the device in a variable which is used to open the device. All of this is currently done in a thread.
When cycling through the devices in the for loop, it always skips the first device. So, if the user wants to use device 1 of 3, the dll wont use 0, instead it fails, because 0 doesn't exist to it.
If I do the for loop in a function outside the thread, it sees all three, but I can't pass the thread the devs name, because it needs to be initilised in thread. At least that is how it seems, considering it caused a crash at run-time. I simply tried to define the variable the device opening portion needs in the separate function, I didn't actually pass it from the separate function to the thread function. I am not sure how or even if I can pass an argument to the thread function.
My question is, why wont the dll see three devs in the thread, though it sees them in the separate function? And, what do I need to do to fix it? If you need more info, let me know. Thanks in advance, have a nice day.
|
|
|
|
|
Hi borono,
It's kinda hard to pinpoint your problem without seeing any code. Could you possibly show us how you send the data, convert it and use it.
|
|
|
|
|
Geez, almost forgot I even made this post. Well, it isn't with the sendage of the data, it is with the thread. I know this because inside the thread the dev enum only sees two out of three, outside the thread the dev enum sees all three. So, it must be due to the thread.
Out side of thread: (shows all three)
for(d=alldevs; d; d=d->next)
{
if (d->description) {
MessageBox(NULL,d->description,0,0);
}
Now when the user selects a dev from the VB app and clicks start, the VB app sends the data and it is shaved by one and stored as u_int. Then in that same stdcall function, the thread is initialized. The thread grabs the variable and uses it here:
for (d=alldevs, i=0; i< ved ;d=d->next, i++);
Note: ved is my u_int variable that was used to store the data from VB.
Inside the thread...
for(d=alldevs; d; d=d->next)
{
if (d->description) {
MessageBox(NULL,d->description,0,0);
}
...that only sees two, but outside the thread it sees all three. I made checks on that variable (ved) and it is the value it should be. It is that the thread is messed up somehow, only seeing two of three devs.
Hope that helps clarify it a bit. Let me know if you need more info. Thanks in advance.
|
|
|
|
|
So, I am busy porting my MFC app from VC6 to VC8 and so far all is going rather well. Other then a bunch of warnings about deprecated CRT functions that were fairly easy to solve I am down to only two errors.
The first one comes about from simply including the WAB.h header file. It generates the following error
c:\program files\microsoft visual studio 8\vc\platformsdk\include\wabdefs.h(78) : error C2371: 'WCHAR' : redefinition; different basic types
c:\program files\microsoft visual studio 8\vc\platformsdk\include\winnt.h(266) : see declaration of 'WCHAR' It seems kind of stupid that simply including a file provided by in the PSDK would generate an error like that. I will have to find some kind of work around.
The second one is that the file WinFax.h that is needed to use the FaxStartPrintJob API is not included with VS 2005. I am wondering if I should copy the old versions that I have (Feb 2001 PSDK) over to the new VC8 SDK directories. Or is a more current version to be found elsewhere?
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
|
PJ Arends wrote: "Treat wchar_t as built-in type"
What exactly does that option do? Will the compiler generate different code? Will L"strings" stop working?
|
|
|
|
|
From what I get from the link I provided, if wchar_t is treated as a built in type then it is treated the same as a char, short, long etc. When I turn the option off then wchar_t is simply a typedef for an unsigned short.
I think the advantage is when doing type checks with wchar_t as a built in type the complier can tell the difference between wchar_ts and unsigned shorts, otherwise it can not tell the difference. Everything else should work the same AFAIK.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Jörgen Sigvardsson wrote: What exactly does that option do? Will the compiler generate different code? Will L"strings" stop working?
No. If you enable that option, literal unicode strings are given the type wchar_t . This type is considered a distinct type by the compiler (not a typedef'd unsigned short ). The advantage is it is more typesafe, and you don't have to do a typedef yourself. The disadvantage is you have to look for type conflicts in existing code - it's an option you'd want to enable at the beginning of a project.
You can freely typecast between wchar_t and unsigned short , although I'm not sure whether the compiler will do it implicitly.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
hi
i am programming with vc++ 2005 ,i use an acces database with ODBC.i can add data to the database ,but my problem is to read from my database .
is there any idea that can help me ?
|
|
|
|
|
More details about your problem please --- what you HAVE DONE for reading the data from the tables in the database.
Maxwell Chen
|
|
|
|
|
I'm running VC++ Express .Net 2005, and i'm trying to compile an application with the native subsystem. I am getting a linker error reading "Unresolved external symbol _NtProcessStartup. I have tried preprocessor definitions and defining it as a function, but nothing has worked. The symbol isn't in any library. Can anyone help? (This is actually from the General Discussion board, but someone advised me to put it here.)
__________________________________________
Let's push Satan
|
|
|
|
|
EntryPoint[^].
You have to check your linker options, as:
/SUBSYSTEM:NATIVE /DRIVER:WDM –entry:NtProcessStartup
Maxwell Chen
|
|
|
|
|
Hi,
How would i get the current windows directory while in kernel mode?
Kernel mode means Win32 APIs dont work so i cant use GetWindowsDirectory
|
|
|
|
|
If you're accessing a file, you could use the environment variable "%WINDIR%".
__________________________________________
Let's push Satan
|
|
|
|
|
Anybody know how to get internet connection speed ??
Thank you for your time!
Servia Nostrum Regnum
-- modified at 20:52 Saturday 15th April, 2006
|
|
|
|
|
Anythig about internet connection speed,some link,hint,anything ???
Thx!
Servia Nostrum Regnum
|
|
|
|
|
how to define inline function in class complied under VC++ win console app?
"test.h"
class test
{
...
inline void func(void);
}
"test.cpp"
inline void test::func(void)
{
...
}
produces LNK2019 error
and whats the project settings for inline function expansion?
9ine
|
|
|
|
|
9ine wrote: "test.h"
class test
{
...
/* inline */ void func(void);
}
"test.cpp"
inline void test::func(void)
{
...
}
Maxwell Chen
|
|
|
|
|
this gets LNK2001: unresolved external
9ine
|
|
|
|
|
Try this[^].
Maxwell Chen
|
|
|
|
|
|
Your code must be in the header file. You can either put it after the class definition and use the keyword inline or put the code inside the class definition right where you declare the method. In both cases, don't use the inline keyword inside the class definition.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Well its a wierd to put function defenition into the header file, the only situation for this when you have templates
In Borland Builder we can keep inline function defenition in cpp files.
Can we keep somehow in VC++ inline functions declared in cpp file?
but anyway it is now compiled
"test.h"
class test
{
...
inline void function();
}
inline void test::function()
{
...
...
}
9ine
|
|
|
|
|
You can put inline function definitions in the .cpp file, but the compiler will never inline them. If you want the compiler to inline them, they must be in the header file. I'd be surprised if Borland does this differently.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I dont know if Borland really makes them inline but it doesnt produce error link messages when inline function is in cpp file compared to VC++
9ine
|
|
|
|