|
I have a cpp code, I had difficulty in doing the conversion to visual basic 6, is there anything that can help me. The following sample cpp program is:
// Defined to disable deprecated functions warning in Visual C++ 2005
#define _CRT_SECURE_NO_DEPRECATE 1
#include <windows.h>
#include <stdio.h>
#pragma pack(1) // set byte packing
typedef struct {
unsigned __int32 bLength;
char szSerNum[9];
char szProdName[9];
unsigned __int64 MinFreq;
unsigned __int64 MaxFreq;
struct {
unsigned __int32 ExtRef:1;
unsigned __int32 FMWEnabled:1;
unsigned __int32 Reserved:30;
} Features;
} RADIO_INFO2;
#pragma pack() // set back the default packing
// G305 API function type declarations
typedef int (__stdcall *FNCOpenRadioDevice)(int iDeviceNum);
typedef BOOL (__stdcall *FNCCloseRadioDevice)(int hRadio);
typedef BOOL (__stdcall *FNCGetInfo)(int hRadio,RADIO_INFO2 *info);
typedef BOOL (__stdcall *FNCSetAtten)(int hRadio, BOOL fAtten);
typedef BOOL (__stdcall *FNCSetPower)(int hRadio, BOOL fPower);
typedef BOOL (__stdcall *FNCSetAGC)(int hRadio, int iAGC);
typedef BOOL (__stdcall *FNCBlockScan)(int hRadio,DWORD *Freqs,size_t Count,int StopSquelchRaw,DWORD FeedbackTime,HWND WinHandle,DWORD Msg);
typedef BOOL (__stdcall *FNCStopBlockScan)(int hRadio);
typedef BOOL (__stdcall *FNCCodecStart)(int hRadio,void (__stdcall *CallbackFunc)(void *),void *CallbackTarget);
typedef BOOL (__stdcall *FNCCodecStop)(int hRadio);
int main(int argc, char* argv[])
{
// load the G3 API library
HMODULE dll=LoadLibrary("wrg305api.dll");
if (!dll) {
puts("WRG305API.DLL not found !");
return 0;
}
// link G3 API functions
FNCOpenRadioDevice OpenRadioDevice=(FNCOpenRadioDevice)GetProcAddress(dll,"OpenRadioDevice");
FNCCloseRadioDevice CloseRadioDevice=(FNCCloseRadioDevice)GetProcAddress(dll,"CloseRadioDevice");
FNCGetInfo GetInfo=(FNCGetInfo)GetProcAddress(dll,"GetInfo");
FNCSetAtten SetAtten=(FNCSetAtten)GetProcAddress(dll,"SetAtten");
FNCSetPower SetPower=(FNCSetPower)GetProcAddress(dll,"SetPower");
FNCSetAGC SetAGC=(FNCSetAGC)GetProcAddress(dll,"SetAGC");
FNCBlockScan BlockScan=(FNCBlockScan)GetProcAddress(dll,"BlockScan");
FNCStopBlockScan StopBlockScan=(FNCStopBlockScan)GetProcAddress(dll,"StopBlockScan");
FNCCodecStart CodecStart=(FNCCodecStart)GetProcAddress(dll,"CodecStart");
FNCCodecStop CodecStop=(FNCCodecStop)GetProcAddress(dll,"CodecStop");
if (!GetInfo || !BlockScan || !StopBlockScan) {
puts("Not all needed API function not found. Please update the WR-G305 software!");
FreeLibrary(dll);
return 0;
}
// open the first available radio
int hRadio=OpenRadioDevice(0);
if (!hRadio) {
puts("No G305 device could be opened !");
FreeLibrary(dll);
return 0;
}
// obtain the radio info to be able to detect USB connected receivers
RADIO_INFO2 radio_info;
radio_info.bLength=sizeof(radio_info);
GetInfo(hRadio,&radio_info);
// check for USB receiver
BOOL USB_recv=FALSE;
if (!memcmp(radio_info.szProdName,"G3USBv",6)) {
puts("USB receiver detected");
USB_recv=TRUE;
}
// set Power,AGC and Attenuator
if (SetPower(hRadio,TRUE)) puts("The device is turned ON");
else puts("The device failed to turn ON");
if (SetAtten(hRadio,FALSE)) puts("The attenuator is OFF");
else puts("The attenuator failed to turn OFF");
if (SetAGC(hRadio,3)) puts("The AGC is FAST");
else puts("The AGC failed to switch");
// for USB receivers codec streaming must be started
if (USB_recv) CodecStart(hRadio,NULL,NULL);
// prepare the buffer for the blockscan from 600 to 800 kHz
size_t i;
DWORD Freqs[101]; // buffer for frequencies to scan
for (i=0;i<=100;i++) Freqs[i]=(DWORD)(88000000+200000*i);
// let's start the blockscan with 1001 frequencies, don't stop by Squelch.
// no feedback (after a million ms), don't send us the buffers, we'll check that all
if (BlockScan(hRadio,Freqs,101,256,1000000,NULL,0)) puts("The block scanning started..");
else puts("The block scanning failed to start");
puts("Scanned data:");
for (i=0;i<=100;i++) {
while (Freqs[i]>255) Sleep(10); // the frequency is not scanned yet, we have to wait
//printf("Freqsss: %ld\tRAW:%ld\n",88000000+200000*i,Freqs[i]);
printf("Freqsss: %ld\tRAW:%ld\n",Freqs[i]);
}
// the block scanning is over
if (StopBlockScan(hRadio)) puts("Block scanning is stopped");
else puts("Block scanning couldn't stop");
// for USB receivers codec streaming must be stopped
if (USB_recv) CodecStop(hRadio);
// close the device handle
if (CloseRadioDevice(hRadio)) puts("The device is closed properly");
else puts("The device failed to close");
// free the G3 API library
FreeLibrary(dll);
return 0;
}
|
|
|
|
|
i didn't see any question, you are asking us to convert for you? 
|
|
|
|
|
densti wrote: I have a cpp code, I had difficulty in doing the conversion to visual basic 6, is there anything that can help me.
C++ to VB6?
VB6 has been deprecated, meaning that there's only minimal support available. Next to that, VB6 does not facilitate all that's possible in C++.
Compile your code using watcom or whatever and link to it - and stay away from VB6. There's no new technology created using that technology, since there's no place left to buy a new compiler. It "might" run on Win8 with some tweaks, but there's a good chance that the support will be cut in anything beyond Win8.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
|
Hi,
At my work, I have to test a Visual Basic application. I don't have the code source.
Often I get runtime errors. When I get one, I try to understand what is the cause before I contact the developer. Often it is a runtime error.
I want to know if a tool can give information about such errors without having access to the code source.
Any suggestions?
Thanks,
Claude
|
|
|
|
|
Hello,
Try this[] one
Nick
|
|
|
|
|
Gagnon Claude wrote: Often I get runtime errors. When I get one, I try to understand what is the cause before I contact the developer. Often it is a runtime error.
In an ideal world, you'd have a file, generated by the app in debug mode, that mentions all the steps that you took before the exception occurred. That way they have the steps to reproduce the bug.
..and it might be caused by something totally unrelated
Have you considered requesting the code? What is the app created with? In .NET we call them usually exceptions, I'd associate a "run time error" more with classic VB.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Hello everyone I am a beginner to programming with vb.net. Currently I am creating a notepad like application in VB (just for learning and practice). I want to make an installer for it (by using external installation creating utilities) so that I can give it to my friends just like any standard application.
But I have just confused that how I will decide that which files should be placed in installation with the .exe file. Can any one help me, that which other files are needed to properly run the application.
Also currently I am creating the application with visual studio 2005. I don’t have much knowledge about dot net framework. So how can I decide that to someone whom I am giving my application have required dot net framework. And if they don't have than how I can give it to them.
One more thing, is their any windows version (like XP, Vista, 7 etc) related limitation to consider, in order to properly running the application. If yes then please explain it too.
Any other suggestions are appreciated.
Thanks
|
|
|
|
|
you can find it here, goodluck. 
|
|
|
|
|
No friend, I already have idea about it.
What I want is to collect all the files which are required to run my application, put them in other folder, and then create a installer by using a external installer creation utility. (I don't want to use visual studio's setup and deployment wizard). (I request you to read my about post ones again). Now please give me required suggestion. Thanks for your time.
|
|
|
|
|
You should know what your app requires to run. After all, you wrote it!
But, as a general rule of thumb, from the files in the Bin\Release folder, you don't need:
*.vshost.*
*.pdb
myApplicationName.xml
Everything else, you probably need.
|
|
|
|
|
|
I have a vb6 application that contain various drop down menus.
Some user has not permitted to access some menus.
For the purpose Logged in as administrator and list all menus in the application and select a user and check or uncheck whether this user access that menu.
But how can I list all menus in the application without manually enter menu name ? Because when we add new menu in the application, I manually add these menu name in list. And If menu no is 100 or 150 then it is difficult to enter the menu name or control them. So I want the code for list all menus in the application automatically. Please help me.
|
|
|
|
|
I'm a little confused to where you refer to drop down controls and drop down item. but the item once can be done pretty easily by code
dropdownbox.items.add("object, a string as name for example")
with a loop and some if/else statements you should be able to filter what you add by the users permissions.
|
|
|
|
|
Enumerate all objects of type "Menu" in the form and add it to a list from where an administrator can decide to grant permissions.
For instance:
for each myControl in myForm.Controls
if typeOf myControl is Menu then
and so on...
|
|
|
|
|
<pre lang="sql">Ok. thats working.
Then my next doubt is how can I identify main menus and sub menus</pre>
|
|
|
|
|
I'm starting in my intro to programming class. New to this side of computers. My teacher isn't much help so I"m falling behind. Can't get rid of the errors in my code. Pseudocode is supposed so simple from what I hear. If someone can help me do a simple program with this algorithm that would be awesome. Thanks a lot.
|
|
|
|
|
mainshotime wrote: My teacher isn't much help
Get another teacher or talk to a TA
mainshotime wrote: Pseudocode
Pseudocode is simple. It's supposed to be. Pseudocode is not program code!
mainshotime wrote: Can't get rid of the errors in my code
Funny, I do not see an single error in any of the code that you posted.
mainshotime wrote: a simple program with this algorithm
A simple program using what algorithm? You have not posted one word about what it is that you are trying to do.
We are not teachers here either. You will probably not find one single person here willing to do your homework for you. If you get into trouble, then we can help. Post the code that you are having trouble with and ask a clear, concise question and I am sure that someone will be able to help you.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
my teacher is so helpful, so i'm flying in front, i have no error.
i have an awesome simple program with that algorithm, you are welcome.
|
|
|
|
|
mainshotime wrote: Can't get rid of the errors in my code. Pseudocode is supposed so simple from what I hear.
How about you show us your pseudo-code? There can't be any syntax-errors in there, nothing that would keep it from compiling, since there's no fixed set of rules to how pseudo should look. It's merely a description of what the computer should do, in a semi-structured way. Comes very close to how a cook describes baking an omelet;
- Get a pan
- Put it on the stove, turn on the gas
- Throw in some gravy
- ADD BACON
- Do three times:
- Crack egg
- Add egg to gravy
- Heat five minutes
- Eat
I just "made up" the description above, and making up things is usually considered "easy" - there can hardly be an error in above description (if you don't count that the gas is still running when you're eating). If it's wrong according to your teacher, then he sure as Hell should take time to explain why it is wrong in his view and how you can rectify that. If he can't, ask management whether they can replace the babysitter in the class with a teacher.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
I need the on-screen Keyboard codes, which can be written in different languages (keyboard language),please help mi<pre lang="text">
|
|
|
|
|
Something tells me that you do not really understand what this site is all about.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
grigorffef wrote: I need the on-screen Keyboard codes, which can be written in different languages (keyboard language),please help mi
start -> on-screen keyboard -> enter();
|
|
|
|
|
Hello again,
it seems that code translation tools have their problems with Lambda expressions – different from my own but still ... Maybe you can help me again:
C#-code
EventHandler<MailPoppedEventArgs> local = this.MailPopped;
if (local != null){local(this, new MailPoppedEventArgs(index, message, size, uidl, receivedTime));} has been translated to VB.NET this way:
Dim local As EventHandler(Of MailPoppedEventArgs) = Me.MailPopped
If local IsNot Nothing Then local(Me, New MailPoppedEventArgs(index, message, size, uidl, receivedTime)) The resulting error message reminds me that 'MailPopped' is an event so that a 'RaiseEvent' construction is needed. But which would be a proper syntax for the above expression?
Thank you in advance
Mick
|
|
|
|
|
It would look something like this
Dim local As EventHandler(Of MailPoppedEventArgs) = Me.MailPopped
RaiseEvent local(Me, New MailPoppedEventArgs(index, message, size, uidl, receivedTime))
Hope this helps
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|