|
Are you some kind of troll ? Do you really think that somebody will be able to answer any of your questions ?
|
|
|
|
|
The random word generator you have used for this and your previous posts is working perfectly.
If you have developed it yourself you should really post an article about it!
|
|
|
|
|
Hello,
I have an ActiveX control that provides such method:
void GetCurrentImage(long theFormat, VARIANT * theBuffer, long * theBufferSize);
I want to get a byte image buffer from this function. That is, I am trying to do this:
long image_size;
VARIANT FrameBuf[1024*1024];
char ByteBuf[1024*1024];
pCtrl->GetCurrentImage(0, FrameBuf, &image_size);
I did some googling. But partly because VARIANT is a common word that confused Google, I can hardly find any useful solution to this. Can anyone give me some advice? Thank you very much.
Jason
|
|
|
|
|
Creating an array of Variant is wrong.
Try this
VARIANT FrameBuf;
BYTE ByteBuf[1024 * 1024];
FrameBuf.vt = VT_BYREF|VT_UI1;
FrameBuf.pbVal = ByteBuf;
pCtrl->GetCurrentImage(0, FrameBuf, ℑ_size);
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
_Superman_,
Thank you for your kindly reply. I guess you were meaning this, right?
pCtrl->GetCurrentImage(0, &FrameBuf, &size);
since GetCurrentImage() takes a VARIANT* argument.
But after I executed your example code(with GetCurrentImage line replaced with the above one) and checked the ByteBuf, I found its content is unchanged. Did I still miss anything here?
Thanks,
Jason
|
|
|
|
|
Please check the return value of GetCurrentImage to see if it has succeeded.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Unfortuenately, the function is an asyncrous function and returns immediatly, so return value is not useful. I have waited quite some time in the main thread and the check result is the same: the image size is returned correctly, but the buffer is unchanged...
|
|
|
|
|
Hey guys,
I couldn't find the way to display '&' on CMFCToolBarButton. I have a string of "Boy&Girl" and I want to display that string on a CMFCToolBarButton. If I set its text to exactly "Boy&Girl", the text will be displayed as "BoyGirl" due to a window control shortcut.
So.. I replace the original, "Boy&Girl" to "Boy&&Girl" so that I can display '&' character. However, I ended up with Boy Girl".
Now I replace the orignal text with "Boy/&Girl", it displays my text as "Boy Girl".
Do you guys know how to fix this?
Thanks!
Un
|
|
|
|
|
Un Suthee wrote: "Boy&Girl"
Try "Boy&&Girl".
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
I tried that but it does not work.
The problem is I am using CMFCToolBarButton::OnDraw() method.
I looked at the source code of that function and turns out that it does not set a flag "DT_NOPREFIX" in which tells DrawText not to interpret ampersand as a directive to underscore the following character.
So the work around I did is to convert a string "Boy&Girl" to "Boy&&&&Girl" !! What happens is CMFCToolBarButton::OnDraw() will convert this string to "Boy&&Girl" and then CDC::DrawText will now convert "&&" to "&". It works but I guess there must be a much better solution than the one I have.
Thanks!
Un
|
|
|
|
|
Un Suthee wrote: Now I replace the orignal text with "Boy/&Girl"
You should try "Boy\&Girl". Backslash instead of forward slash.
But I guess your workaround is pretty good.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
You should try "Boy\\&&Girl". Backslash instead of forward slash.
I think so it's ok.
|
|
|
|
|
I just tried "Boy\\&&Girl" and I got "Boy\Girl".
Un
|
|
|
|
|
I do not know too,for I am a beginner. haha
Keep running slowly but never stop.
|
|
|
|
|
hi
I am getting error
Unhandled exception at 0x0037bbae in abc.exe: 0xC0000005: Access violation writing location 0x000000a8.
I debugged and it looks like the error happens at a function call.
argMainLoop( MouseEvent, keyEvent, mainLoop );
the three arguments are three functions.
declaration:
void argMainLoop( void (*mouseFunc)(int button, int state, int x, int y),
void (*keyFunc)(unsigned char key, int x, int y),
void (*mainFunc)(void) )
I check the disassembly.
argMainLoop( MouseEvent, keyEvent, mainLoop );
0043DE9F push offset mainLoop (43E410h)
0043DEA4 push offset keyEvent (43DF90h)
0043DEA9 push offset MouseEvent (43DF60h)
0043DEAE call @ILT+4420(_argMainLoop) (436149h)
0043DEB3 add esp,0Ch
the crash is happening at last two lines of the assembly.
The functions that are passed as parameters are all forward declared. all the declarations looked fine(else might have been compiler issue). the error is coming up in run time in debug and release configurations.
I am stuck here with no idea how to proceed in identifying the error. Any hints would be very helpful
|
|
|
|
|
How are declared and defined the callback functions?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
the definitions seems to be fine.
static void MouseEvent( int a, int b, int c, int d);
static void keyEvent( unsigned char key, int x, int y);
static void mainLoop(void);
int main(int argc, char **argv)
{
glutInit(&argc, argv);
init();
arVideoCapStart();
argMainLoop( MouseEvent, keyEvent, mainLoop );
return (0);
}
static void MouseEvent( int a, int b, int c, int d)
{
}
static void keyEvent( unsigned char key, int x, int y)
{
char message[100];
if( key == 0x1b ) {
printf("*** %f (frame/sec)\n", (double)count/arUtilTimer());
cleanup();
exit(0);
}
if( key == 'c' ) {
printf("*** %f (frame/sec)\n", (double)count/arUtilTimer());
count = 0;
if( mode ) printf("Continuous mode: Using arGetTransMatCont.\n");
else printf("One shot mode: Using arGetTransMat.\n");
}
if(key =='r'|| key =='R')
{
out<<"***";
std::cin>>message;
out<<message<<std::endl;
for(int j=0; j<3; j++)
for(int k=0; k<3; k++)
rot[j][k] = model[j][k];
arGetAngle(rot, &rx, &ry, &rz);
tx =model[0][3];
ty =model[1][3];
tz = model[2][3];
out<<tx<<" "<<ty<<" "<<tz<<" "<<rx<<" "<<ry<<" "<<rz<<std::endl;
}
}
static void mainLoop(void)
{
static int contF = 0;
ARUint8 *dataPtr;
ARToolKitPlus::ARMarkerInfo *marker_info;
int marker_num;
int j, k;
if( (dataPtr = (ARUint8 *)arVideoGetImage()) == NULL ) {
arUtilSleep(2);
return;
}
if( count == 0 ) arUtilTimerReset();
count++;
argDrawMode2D();
argDispImage( dataPtr, 0,0 );
int markerId = tracker->calc(dataPtr,-1,true, &marker_info);
float conf = (float)tracker->getConfidence();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glLoadMatrixf(tracker->getModelViewMatrix());
printf("\n\nFound marker %d (confidence %d%%)\n\nPose-Matrix:\n ", markerId, (int(conf*100.0f)));
for(int i=0; i<16; i++)
printf("%.2f %s", tracker->getModelViewMatrix()[i], (i%4==3)?"\n " : "");
tracker->getARMatrix(model);
contF = 1;
argSwapBuffers();
}
|
|
|
|
|
There's probably a stack overflow happening in one of the functions.
Try commenting out all code in the functions that are passed as parameter to argMainLoop.
Do you really need local scope (static) for the functions?
My advice is to typedef the function pointers.
It would be more neat.
Example,
typedef void (*MOUSE_EVENT)( int a, int b, int c, int d);
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
hello :]
I have a problem with my dialog(s) and I did some screens in order to explaine easier where I am stucked.
Since english is not my language, please accept appologies in advance, if I may sound a little bit unclear.
I have made the following dialog:
http://i213.photobucket.com/albums/cc181/ves604/komp/01.jpg
which as you see, has more than one part. On the left side is list-menu, where user can choose one of 4 options, that
will show on the right side, in the place of child dialog. That child dialog is attached to the main one (the parent),
each time when I call one of those 4 options, I have to do that. We have written funstion "AttachChildDlg", and also, "DetachChildDlg"
that does the opposite: when I want to get from ie first child (that is first option) to third child (third option in menu), I have to
detach the first one, and after, attach the third one as new one. That is doing very well.
the problem gets with this: when I have this, first child, which contains another child dialog in itself (that list with some data),
and if from that one, I call another dialog by pressing some button, and then from that one another dialog, do something there, return with OK to previous,
then from that one - return again to previous (the original one) - what I get then is that my child dialog inside the first child - has dissapeared.
I know this might sound lot difficult, so I am giving these screenshots, as photo can speak instead of thousand words
when I click on that dialog, on red-circled button, I open another dialog,
http://i213.photobucket.com/albums/cc181/ves604/komp/02.jpg
then I mark something on right side, and open another dialog,
http://i213.photobucket.com/albums/cc181/ves604/komp/03.jpg
now, if I return with OK to previous, and then again to very first one, I get this:
http://i213.photobucket.com/albums/cc181/ves604/komp/04.jpg
soo..if anybody has any idea what might gone wrong, please write it. I can post you part of code of course.
Maybe there is something in dialog properties that I didn't use properly, but I tried so many combinations..
thank you
I am working in Visual Studio 2005, C++
|
|
|
|
|
andrassy wrote: On the left side is list-menu, where user can choose one of 4 options...
I see 5. I doubt that matters, however.
andrassy wrote: ...when I want to get from ie first child (that is first option) to third child (third option in menu), I have to
detach the first one, and after, attach the third one as new one. That is doing very well.
But it's way too complicated. Why not just have a property sheet with four (or five) property pages? Your problems will likely 'disappear' after that.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Is the list of "Field Device Properties" a child dialog or some sort of custom control?
If its a control, I'm guessing it is a painting problem.
You should try to invalidate or repaint the control after the child dialog is dismissed.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
«_Superman_» wrote: Is the list of "Field Device Properties" a child dialog or some sort of custom control?
If its a control, I'm guessing it is a painting problem.
You should try to invalidate or repaint the control after the child dialog is dismissed
yes, Field Device Properties is child indeed - so we have child in child situation. the thing is, not the whole child dialog dissapears, but only list control in int. see these pics:
http://i213.photobucket.com/albums/cc181/ves604/komp/01-1.jpg
http://i213.photobucket.com/albums/cc181/ves604/komp/04.jpg
DavidCrow wrote:
But it's way too complicated. Why not just have a property sheet with four (or five) property pages? Your problems will likely 'disappear' after that.
yes, 5 options, just a writing mistake
I am sorry but I do not understand what is property sheet with n pages?
I had to do this with picture control: it was needed for child position, so when it attaches, it sets on pict. control position. At least, collegue had done that way on some other dialog in our programme, do you have idea for something different?
|
|
|
|
|
I solved the problem; it was something real stupid: that picture control, that I used to place child dlg on parent dlg, was set to be visible - it occured to me that is should be put as "not visible" - and all is all right now.
thank you all on topic for help.
|
|
|
|
|
Hi All,
I had a general query regarding modal dialogs and child windows.
Is there any way by which I can restrict a CDialog instance to be
within the client area of a parent window and yet also allow DoModal method
to work correctly ?
From what i`ve seen so far, such dialogs show the CWnd value passed to them
in the constructor as the parent/owner in Spy++ but can still be moved out of it when
the modal loop starts.
Doing a SetParent causes both the parent and dialog to hang when i call DoModal.
Thanks in Advance.
|
|
|
|
|
Hello,
Change the style of the dialog as "Child" from the property window and now try.
but DoModal won't work fine I think because when you do "DoModal()". the parent window being disabled thus the all of it's child windows will be disabled and you will not be able to operate anything within the new window you're showing. But the dialog will be restricted inside the parent's client area. Why you can't use Modeless dialog?
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|