Click here to Skip to main content
15,887,027 members
Home / Discussions / C#
   

C#

 
AnswerRe: Executing code continuously while button is pressed Pin
Ravi Bhavnani26-Apr-06 4:16
professionalRavi Bhavnani26-Apr-06 4:16 
QuestionHelp Pin
yantir26-Apr-06 3:53
yantir26-Apr-06 3:53 
AnswerRe: Help Pin
g00fyman26-Apr-06 4:23
g00fyman26-Apr-06 4:23 
AnswerRe: Help Pin
J4amieC26-Apr-06 4:46
J4amieC26-Apr-06 4:46 
AnswerRe: Help Pin
V.26-Apr-06 5:00
professionalV.26-Apr-06 5:00 
AnswerRe: Help Pin
Richard Parsons26-Apr-06 10:27
Richard Parsons26-Apr-06 10:27 
AnswerRe: Help Pin
Josh Smith26-Apr-06 10:33
Josh Smith26-Apr-06 10:33 
QuestionA strange problem with method parametrs Pin
t4ure4n26-Apr-06 3:52
t4ure4n26-Apr-06 3:52 
I a calling an API method which requires passing the reference to an array as parameter. The problem is with that parameter

The actual function is
BOOL __stdcall G3BlockScan(int hRadio,<big>DWORD *Freqs</big>, int Count,int StopSquelchRaw, DWORD FeedbackTime,HWND WinHandle,DWORD Msg);

Here Freqs is an array whose contents are mofied by the The API function call.

I have wrapped this function in C# as follows..

[DllImport("wrg303api.dll")] <br />
public static extern bool G3BlockScan(int hRadio, <big>uint [] Freqs</big>, int Count,int StopSquelchRaw,uint FeedbackTime,IntPtr WinHandle,uint Msg);

and the function call is like this .....
..... some code.....<br />
 uint[] Freqs = new uint[1001];  // buffer for frequencies to scan<br />
..... some code....<br />
 if (!clsApiWrapper.G3BlockScan(radioHandle, <big>Freqs</big>, 1001, 256, 100000, pointer,Msg))<br />
   MessageBox.Show("The block scanning failed to start", "WiNRADiO - Error Message", MessageBoxButtons.OK, MessageBoxIcon.Error);     <br />
..... some code ....

But now when I run the app it doesn't change the contents of the array. so I believe I need to pass the reference of the array to the function. And if I change the code like this to pass the reference of the array

[DllImport("wrg303api.dll")] <br />
public static extern bool G3BlockScan(int hRadio, <big>ref uint [] Freqs</big>, int Count,int StopSquelchRaw,uint FeedbackTime,IntPtr WinHandle,uint Msg);<br />
<br />
..... some code.....<br />
 uint[] Freqs = new uint[1001];  // buffer for frequencies to scan<br />
..... some code....<br />
 if (!clsApiWrapper.G3BlockScan(radioHandle,<big>ref Freqs</big>, 1001, 256, 100000, pointer,Msg))<br />
   MessageBox.Show("The block scanning failed to start", "WiNRADiO - Error Message", MessageBoxButtons.OK, MessageBoxIcon.Error);


Now when I access the Freqs array after the method call I encounter a strange behaviour.. The size of Freqs array is reduced from 1000 to 1.
I can't figure out what is going wrong.

Can any1 plz suggest what to do.
Questionhi agian i repeat my question about web part!! Pin
abdallahziad26-Apr-06 3:42
abdallahziad26-Apr-06 3:42 
AnswerRe: hi agian i repeat my question about web part!! Pin
The Ladies' Man26-Apr-06 3:47
The Ladies' Man26-Apr-06 3:47 
GeneralRe: hi agian i repeat my question about web part!! Pin
Smith#26-Apr-06 4:05
Smith#26-Apr-06 4:05 
GeneralRe: hi agian i repeat my question about web part!! Pin
The Ladies' Man26-Apr-06 4:26
The Ladies' Man26-Apr-06 4:26 
AnswerRe: hi agian i repeat my question about web part!! Pin
J4amieC26-Apr-06 4:50
J4amieC26-Apr-06 4:50 
QuestionWeb services Pin
Mamphekgo26-Apr-06 3:32
Mamphekgo26-Apr-06 3:32 
AnswerRe: Web services Pin
Rob Philpott26-Apr-06 6:51
Rob Philpott26-Apr-06 6:51 
AnswerRe: Web services Pin
Tom Larsen26-Apr-06 11:00
Tom Larsen26-Apr-06 11:00 
QuestionPlease Reply Me Pin
dayakar_dn26-Apr-06 3:30
dayakar_dn26-Apr-06 3:30 
AnswerRe: Please Reply Me Pin
Josh Smith26-Apr-06 3:35
Josh Smith26-Apr-06 3:35 
AnswerRe: Please Reply Me Pin
Drew McGhie26-Apr-06 3:46
Drew McGhie26-Apr-06 3:46 
AnswerRe: Please Reply Me Pin
J4amieC26-Apr-06 3:46
J4amieC26-Apr-06 3:46 
QuestionPlease Reply Me Pin
dayakar_dn26-Apr-06 2:59
dayakar_dn26-Apr-06 2:59 
AnswerRe: Please Reply Me Pin
The Ladies' Man26-Apr-06 3:03
The Ladies' Man26-Apr-06 3:03 
AnswerRe: Please Reply Me Pin
Josh Smith26-Apr-06 3:30
Josh Smith26-Apr-06 3:30 
QuestionVisio 2003 Problem Pin
salman_syed_0126-Apr-06 2:54
salman_syed_0126-Apr-06 2:54 
AnswerRe: Visio 2003 Problem Pin
The Ladies' Man26-Apr-06 3:07
The Ladies' Man26-Apr-06 3:07 

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.