Click here to Skip to main content
15,887,135 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionHelo Guys i need your help Pls Pin
samfrancis10-Jul-12 1:18
samfrancis10-Jul-12 1:18 
AnswerRe: Helo Guys i need your help Pls Pin
Nick Otten10-Jul-12 2:36
Nick Otten10-Jul-12 2:36 
AnswerRe: Helo Guys i need your help Pls Pin
Wes Aday10-Jul-12 2:56
professionalWes Aday10-Jul-12 2:56 
AnswerRe: Helo Guys i need your help Pls Pin
Sonhospa10-Jul-12 8:26
Sonhospa10-Jul-12 8:26 
Questionadministrator privilage Pin
info4shajeer9-Jul-12 22:58
info4shajeer9-Jul-12 22:58 
AnswerRe: administrator privilage Pin
Richard MacCutchan9-Jul-12 23:15
mveRichard MacCutchan9-Jul-12 23:15 
GeneralRe: administrator privilage Pin
info4shajeer2-Aug-12 9:45
info4shajeer2-Aug-12 9:45 
Questioncpp code convert to visual basic 6 Pin
densti9-Jul-12 16:50
densti9-Jul-12 16:50 
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;
}
AnswerRe: cpp code convert to visual basic 6 Pin
Midnight Ahri9-Jul-12 19:01
Midnight Ahri9-Jul-12 19:01 
AnswerRe: cpp code convert to visual basic 6 Pin
Eddy Vluggen10-Jul-12 0:35
professionalEddy Vluggen10-Jul-12 0:35 
AnswerRe: cpp code convert to visual basic 6 Pin
shubham salwan12-Jul-12 18:21
shubham salwan12-Jul-12 18:21 
QuestionRuntime error debugging Pin
Gagnon Claude9-Jul-12 16:08
Gagnon Claude9-Jul-12 16:08 
AnswerRe: Runtime error debugging Pin
Nick Otten9-Jul-12 20:36
Nick Otten9-Jul-12 20:36 
AnswerRe: Runtime error debugging Pin
Eddy Vluggen10-Jul-12 0:40
professionalEddy Vluggen10-Jul-12 0:40 
QuestionSuggestion about creating a installer of VB application Pin
Student102308-Jul-12 0:11
Student102308-Jul-12 0:11 
AnswerRe: Suggestion about creating a installer of VB application Pin
Midnight Ahri8-Jul-12 22:07
Midnight Ahri8-Jul-12 22:07 
GeneralRe: Suggestion about creating a installer of VB application Pin
Student102309-Jul-12 6:43
Student102309-Jul-12 6:43 
GeneralRe: Suggestion about creating a installer of VB application Pin
Dave Kreskowiak9-Jul-12 7:00
mveDave Kreskowiak9-Jul-12 7:00 
GeneralRe: Suggestion about creating a installer of VB application Pin
Student1023013-Jul-12 23:38
Student1023013-Jul-12 23:38 
QuestionList out all menus in vb6 application Pin
ssa20107-Jul-12 21:34
ssa20107-Jul-12 21:34 
AnswerRe: List out all menus in vb6 application Pin
Nick Otten8-Jul-12 20:48
Nick Otten8-Jul-12 20:48 
AnswerRe: List out all menus in vb6 application Pin
ChandraRam8-Jul-12 22:37
ChandraRam8-Jul-12 22:37 
GeneralRe: List out all menus in vb6 application Pin
ssa201016-Jul-12 19:38
ssa201016-Jul-12 19:38 
QuestionVisual Basic Pin
mainshotime7-Jul-12 13:47
mainshotime7-Jul-12 13:47 
AnswerRe: Visual Basic Pin
Wes Aday7-Jul-12 14:35
professionalWes Aday7-Jul-12 14:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.