|
Hi Experts,
I need to capture the Video frame buffer on Windows Mobile platform. I am using Windows Mobile 5.0 SDK for the same purpose. It provides me GAPI interface to get the framebuffer. (GX.LIB).
Unfortunately, I am not able to link with GX.LIB and I am getting the linking error when try to open the display.
error LNK2019: unresolved external symbol "__declspec(dllimport) int __cdecl GXOpenDisplay(struct HWND__ *,unsigned long)" (__imp_?GXOpenDisplay@@YAHPAUHWND__@@K@Z
Windows Mobile 5.0 Pocket PC SDK (ARMV4I).. fatal error LNK1120: 1 unresolved externals
I found GX.LIB and GX.H are present in the PATH.
I am new to Windows Environment is there anything else I have to do to get access to the functions of GX.LIB. I am sorry it's very silly question.
Thanks & Best Regards,
|
|
|
|
|
Verify the path where u r giving gx.lib and also give it refernce to gx.dll
Subhash jain(Sundyne Technologies pvt. ltd Lower parel Mumbai)
|
|
|
|
|
Recently, i develop an programme about sniffer by MFC.
in this period,i use TabControl which consist of two child dialogs.
now in order to correspond to the main dialog which the TabControl locate in,I need adjust the size of TabControl and two dialog to main dialog.
The size of tabcontrol has adjusted ,but I don't know how to realize the adjusting the size of two child dialogs to the main dialog ?
Thank you for your help !
|
|
|
|
|
I assume the dialogs are modeless ? If so, you need to call a method, instructing them to resize. If not, you should set them up to pass in a size when you create them.
Christian Graus - C++ MVP
|
|
|
|
|
Hello all,
I cannot access names[0] and names[1] inside function B. It is null if i try to access them. Can anyone help ?
funcA{<br />
char * Names[] = {};<br />
int next = 0;<br />
char * list = "Abc";<br />
<br />
<br />
Names[ next ] = malloc( sizeof( char )*( strlen( list ) + 1 ) );<br />
memcpy( Names[ next ],list,sizeof( char )*( strlen( list ) + 1 ) );<br />
<br />
list = "cdefg";<br />
Names[ next+1 ] = malloc( sizeof( char )*( strlen( list ) + 1 ) );<br />
memcpy( Names[ next+1 ],list,sizeof( char )*( strlen( list ) + 1 ) );<br />
<br />
printf("vsp list got is %s\n", Names[0] );<br />
printf("vsp list got is %s\n", Names[1] );<br />
<br />
funcB(....,...,(const char**)&Names);<br />
}<br />
<br />
funcB(...,...,const char ** names)<br />
{<br />
....<br />
...<br />
free( (char*)names[0]);<br />
free( (char*)names[1]);<br />
<br />
}
|
|
|
|
|
This is C, not C++ ?
I believe you want to cast Names to char **, and not the address of Names. I think an array is a pointer by definition. You could also declare Names as char **.
Christian Graus - C++ MVP
|
|
|
|
|
This is C. this is my first small exercise in pointers and arrays.
a.)Where do you say I have to cast Names to char**?
I should be able to access all the names inside function B. How should i do it?
b.)If i declare as char ** Names, then how do I do malloc on Names[0]?
It will be great help for me to understand better if you could show/make changes in the code snippet.
Thanks for your time.
|
|
|
|
|
In C++, I would do this:
char ** names = new char * [2];
names[0] = new char[len1];
names[2] = new char[len2];
Where len1 and len2 are the lengths of my strings. I guess you can use malloc in the same way.
I'm saying that when you pass &Names, I think it's a char ***, because a char * [] is the same as a char **. At least, I think so.
Christian Graus - C++ MVP
|
|
|
|
|
char ** names = new char *[2];
but I do not know if the names would be just 2 ...say if it is to be any number of names. then how do we do it?
|
|
|
|
|
I see what you'e doing. You can't dynamically add to an array. You can put a variable in place of the 2, but you can't add to the list, to do that you need to write a dynamically allocated array ( which typically keeps some space in reserve, and then reallocates itself to a new memory block when more is needed ).
C++ has classes to do this, I don't believe there is anything in C.
Christian Graus - C++ MVP
|
|
|
|
|
thanks for that.
If Say, i know the dimension of the array.
int count =4;<br />
int i = 0;<br />
char * Names[count];<br />
<br />
for(i=0; i < count; i++)<br />
{<br />
Names[i] = NULL;<br />
}<br />
and then do the rest. Is the initialisation correct?
is what i have done equivalent to doing
char *Names[4] = {NULL,NULL,NULL,NULL};
|
|
|
|
|
Yes, I believe so. Again, I think your core problem is solved by passing Names instead of &Names.
Christian Graus - C++ MVP
|
|
|
|
|
modified. ....
thanks.
i have another issue:
const char * str1 = "abcdef";<br />
const char * str2;<br />
when i try to do:<br />
strcpy(str2,str1);<br />
there is warning message.-- passing arg 1 of `strcpy' discards qualifiers from pointer target type
but when i try to run the code (using gcc),
the code crashes at strcpy()
why? how to fix this warning?
|
|
|
|
|
strcpy copies the value of a string, I don't believe it actually allocates the memory for you. You need to make str2 point to valid memory first.
Christian Graus - C++ MVP
|
|
|
|
|
sorry i have modified my previous post. i do get a warning.
passing arg 1 of `strcpy' discards qualifiers from pointer target type
|
|
|
|
|
probably the const
Christian Graus - C++ MVP
|
|
|
|
|
hi...I tried doing the following:
const char* str1 = "abcd";
char* str2;
strcpy(str2,str1);
There is no compilation error or warning. but the program crahses at this stcpy line. Why would it?
Can I do this?
str2= str1;
will this work? what happens when i dothis?
|
|
|
|
|
*sigh* please read my answer from before. str2 should NEVER be declared like this, set all pointers to NULL until you give them a valid value. str2 is not valid, and it's pointing at junk, hence the error.
Christian Graus - C++ MVP
|
|
|
|
|
thanks. fixed it.
i need to split a string in to tokens using delimiter but without using the strtok( ) or the strtok_r functions.
ie., const char * str1 = "apple+mango+grapes+orange";
i need to spli them into
apple
mango
grapes
orange
the delimter here is "+".
But is there a way (code snippet) that would do the above without using the strtok functions?
|
|
|
|
|
Yes, you can do what strtok does, make a temporary pointer, and keep pointing to the place past the last delimited ( first replacing the delimiters with NULL ).
Christian Graus - C++ MVP
|
|
|
|
|
Thanks very much for your help. It has been a good learning experience.
Back to my sqaure1 problem,,,,In the following code, the names are null when i try to access them inside funcB. why?
Should I do malloc for Names? if so, how?
funcA{<br />
array = 4;<br />
char * Names[array];<br />
int next = 0;<br />
int i;<br />
<br />
for(i=0;i<array+1;i++)<br />
{<br />
Names[i]=NULL;<br />
}<br />
<br />
char * list = "Abc";<br />
Names[ next ] = malloc( sizeof( char )*( strlen( list ) + 1 ) );<br />
memcpy( Names[ next ],list,sizeof( char )*( strlen( list ) + 1 ) );<br />
<br />
list = "cdefg";<br />
Names[ next+1 ] = malloc( sizeof( char )*( strlen( list ) + 1 ) );<br />
memcpy( Names[ next+1 ],list,sizeof( char )*( strlen( list ) + 1 ) );<br />
<br />
printf("vsp list got is %s\n", Names[0] );<br />
printf("vsp list got is %s\n", Names[1] );<br />
<br />
funcB(....,...,(const char**)&Names);<br />
}<br />
<br />
funcB(...,...,const char ** names)<br />
{<br />
....<br />
...<br />
free( (char*)names[0]);<br />
free( (char*)names[1]);<br />
<br />
}
|
|
|
|
|
thathvamsi wrote: funcB(....,...,(const char**)&Names);
I've told you at least twice to do this:
funcB(....,...,(const char**)Names);
because your array IS a char **, you're passing a char ***.
Christian Graus - C++ MVP
|
|
|
|
|
I did and it still gives null only.
|
|
|
|
|
To be honest, I tried to do a sample project for you, and found that VC will not compile most of your code. What you've posted, does not compile, and cannot compile. Even fixing the typos, VC will not compile it, another ( very non conformant ) compiler might, but VC will not.
Try creating a char **, like I said in the first place.
Christian Graus - C++ MVP
|
|
|
|
|
This actually works just fine. Obviously, all funcB does is free the names, but they are correctly being passed through.
#include <string.h>
#include <malloc.h>
void funcB(const char ** names)
{
//the actual values names[0] and names[1] are to be accessed and used but they are null!!!???
//free names[0] and names[1]
free( (char*)names[0]);
free( (char*)names[1]);
}
void funcA()
{
int array = 4;
char ** Names = new char *[array];
int next = 0;
int i;
//initialise
for(i=0;i < array; ++ i)
{
Names[i]=NULL;
}
char * list = "Abc";
Names[ next ] = (char*) malloc( sizeof( char )*( strlen( list ) + 1 ) );
memcpy( Names[ next ],list,sizeof( char )*( strlen( list ) + 1 ) );
++next;
list = "cdefg";
Names[ next ] = (char*) malloc( sizeof( char )*( strlen( list ) + 1 ) );
memcpy( Names[ next ],list,sizeof( char )*( strlen( list ) + 1 ) );
printf("vsp list got is %s\n", Names[0] );
printf("vsp list got is %s\n", Names[1] );
funcB((const char**)Names);
}
int main(int argc, char* argv[])
{
printf("Hello World!\n");
funcA();
return 0;
}
Christian Graus - C++ MVP
|
|
|
|