|
VC++ compiles it just fine. If it throws up an error about missing "unistd.h", just create a blank file and put it in your include directory. It's not a necessary file, but it saves from messing with the source . I can't remember if it asks for it or not. I think that the generated lex or bison C files include it, but it's not necessary and a blank dummy file works fine.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
In Activex control designed by MFC wizhard, if we put child windows inside it, while embedding this into IE, in IE scroll, painting child windows is improper. If we invalidate child control either in PosChanged event or paint event, flickering occurs. How to solve this painting problem without any flickering. If any idea, please help me.
|
|
|
|
|
Hi,
I have to transfer of one formview(MDI) of data to the other formview(MDI). There is no link between these two formview ,only similarity is that both r derived from CFormView.
I am using "file ". In One formview i have "listbox"(which contain data) and transfer of data to the other formview in "editbox".
Thanks
|
|
|
|
|
You should use a templated function in your parent's window in order to be able to pass data from one form to the other one.
IE:
PassData(csDestinationWndName, TemplatedDataToPass);
Hope this helps...
|
|
|
|
|
Hi all,
At the moment my Dialog based program runs 2 threads from inside ...Dlg.cpp. The user interface is updated by the Dialog box, and I am using one for doing all the main functionality, while the other thread prints to a file every minute to let the user know it hasnt crashed. The way it was supposed to work was if the program crashed the printing to the log would stop and a external program would detect this and restart the program. But if(when!) the program throws an exception the dialog saying an exception comes up and the app keeps running its other threads. Wouldnt an unhandled exception stop all the other threads associated with the process, and if not how could i make it do that so i could restart the program?
Thanks
|
|
|
|
|
Ubersnack wrote:
Wouldnt an unhandled exception stop all the other threads associated with the process
Nope. Exceptions only affect a single thread.
My solution would be to not write to a file at all. I would have the program send a message to the other program (use SendMessage() to the other program's window) periodically, in response to a WM_TIMER message. Do this from the same thread as the one that takes input. If there is an exception, the timer handler will not get called, and the message will not get sent. If the other program doesn't receive a message within a certain time period (I would set it to 2-3 times the message period) then it can restart the program.
Hope this helps,
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
cheers mate
|
|
|
|
|
The only way for your program to crash from an exception is from an unhanded exception. Unhanded exceptions are bugs! Make sure you catch your exceptions. When an exception occurs; notify the dialog, stop all threads, and restart the threads. There is not need to have a 2nd application watching and restarting.
If your application requires a complete restart to get things going again, reorganize your code. It needs to be more object oriented.
Hack on!
Jonathan Craig
www.mcw-tech.com
|
|
|
|
|
Hi CPians!
I am currently trying to write an app that emulates the mousewheel functionnality. A third part software we often use (a kind of text editor) does not seem to handle mouse wheel messages, so i had the idea to set a hook on mouse messages, to identify the top window, and to send a message to that window.
The problem is, the top window does not respond to my PostMessage or SendMessage . If I use "direct" MFC functions (ShowWindow,ScrollWindow ), it works fine, but not when using messages. And the vertical scroll functionnality is only available using a message :
pWndChild->PostMessage(WM_VSCROLL,SB_LINEUP); has no effect at all.
I've also tried to send WM_KEYUP/KEYDOWN messages (trying to make the app react "as if" the user had hit several times the up or down arrow, or pgup/pgdn), but no way.
My pWndChild which is a CWnd* is alright, because it works fine with functions like ShowWindow ,GetWindowText ...
Any idea ?
~RaGE();
|
|
|
|
|
The question is, does the top window process WM_xSCROLL messages, or is it done by one of its children (a contained view, for example)? To sum up, are you sure you're sending the messages to the good window?
All my life, who am I?
|
|
|
|
|
Rage wrote:
Any idea ?
Try setting the lParam of the message to the window handle of the window's scrollbar control.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
shrunkenpic is an array with the picture data. It is an unsigned char array with values between 0 and 255
I want to display it
why this code doesn't work. I get only a gray surface not the picture I expect. The picture in the memory ist ok if i display it with setpixel it works and looks fine but this method is to slow
I get about 10-15 pics per second from a cam, so the way to save it first to a bitmap file and then display it is to slow.
CBitmap bild;
bild.CreateBitmap(348, 260, 1, 8, shrunkenPic);
bild.SetBitmapBits(348*260,shrunkenPic);
CDC imageDC;
imageDC.CreateCompatibleDC(pDC);
imageDC.SelectObject( &bild);
pDC->BitBlt(0, 0, 348, 260, &imageDC, 0, 0, SRCCOPY);
imageDC.DeleteDC();
Any Ideas?
Heiko
|
|
|
|
|
Have you tried something like this?
CBitmap bild;<br />
bild.CreateBitmap(348, 260, 1, 8, shrunkenPic);<br />
bild.SetBitmapBits(348*260,shrunkenPic);<br />
<br />
CImageList imageList;<br />
imageList.Create(348, 260, ILC_COLOR24, 0, 1);<br />
imageList.Add(&bild, (CBitmap *) NULL);<br />
imageList.Draw(pDC, 0, CPoint(0, 0), ILD_NORMAL);
All my life, who am I?
|
|
|
|
|
unfortunately, the displayed picture is only black
this doesn't work
Ohter Ideas?
I think the failure must be in the CBitmap. Its creation must be buggy.
|
|
|
|
|
I never used CBitmap::SetBitmapBits, so I can't tell if it works well.
what is your object pDC? A ClientDC?
All my life, who am I?
|
|
|
|
|
pDC is the DC of the control(picture-control) into which i want to paint the bitmap
CDC *pDC = GetDlgItem(IDC...)->GetDC();
|
|
|
|
|
I've never use a picture control this way, and I don't know if it is possible to use directly its DC.
Why not using directly a CWnd and catch the WM_PAINT message? At least you would have a total control of the drawing.
All my life, who am I?
|
|
|
|
|
The Problem is the creation of the cbitmap. If i load it from a file or from a ressource it works the way i like.
Only to create its own cbitmap makes some trouble
|
|
|
|
|
Have you tried to work with a BITMAP structure (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_2h6a.asp)? Once all the fields of the structure set, it's easy to convert it to a CBitmap object.
All my life, who am I?
|
|
|
|
|
I currently have an array filled with int values from 0 to 255, but I need to pass this array into a function that takes double. So my problem is I can't convert the int array of values 0 to 255 to a double array...I've tried cast and even just defining that original int array as a double. all I get is my data being turned to some very large negative values.
Is there a way ard this?
Thnx.
|
|
|
|
|
I think you've castet only the pointer.
You will have to make an new array and then cast every value into the new array.
|
|
|
|
|
You'd like to think it to be as simple as:
int nNumbers[5] = {2, 8, 8, 7, 0};<br />
double dNumbers[5];<br />
memcpy(dNumbers, nNumbers, sizeof(nNumbers));
but since a double is not the same size as an int, this isn't going to work.
It'll take a few more lines of code, but you'll need something like:
for (int x = 0; x < 5; x++)
dNumbers[x] = nNumbers[x]; before calling the function.
|
|
|
|
|
Does anyone know how to write a service to forbid execution of a specified application (ie maybe ???)
Thanks for all.
Lionel
|
|
|
|
|
I don't think it is possible to forbid an application from executing. Allthough I know that in XP there is something ( group policies I think ) where you can block certain applications.
What you could do if you want to block an application is use a system-wide hook in a dll and check when a window is created. From that window you can easily get the executable's name and end the process if you don't want it to run...
Don't think you are, know you are...
|
|
|
|
|
If the application in question is on an NT-type box, you can alter the security/permissions of it so that only certain users/groups can execute it. When your service tries to execute the application, it will error out accordingly.
|
|
|
|