|
I use lex and yacc generate 3 files and want to ues those files in my MFC project.
however, it doesn't work.
How to connect them?
|
|
|
|
|
Chenbuaa wrote:
however, it doesn't work.
What exactly is it that does not work?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hello:
I have an application that makes heavy use of many double buffered images that are dynamicly updated in real time (GDI). I have created the compatible DC's and CBitmaps. I think that I have properly closed all resources as soon as I use them. However when I reach around 64 of these double buffered DC's my application hard-crashes windows with a reboot, and a message in system font that resources have been used up. Is there a limit to the DC stored or is this a symptom of something I am not releasing properly?
|
|
|
|
|
There is a limit to how many DCs can be created at one time, and you just found it . You must use as few DCs as possible, and release them as soon as you're finished with them. You don't need a single DC per bitmap, just select the bitmaps into one DC as you need them. I recommend creating and destroying the compatible DC each time in your drawing method, rather than creating and storing it for later use.
Ryan "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"
|
|
|
|
|
Does DrawDragRect go by current window location or total scroll window location? Cause right now when I scroll it would continue to display page 1 stuff.
|
|
|
|
|
I was fairly disappointed with DrawDragRect - you must do alot of work yourself and clean up once the mouse button is released. There is a function to translate and scale co-ordinates relative to the upper left corner of the client window, which I remember you must use.
|
|
|
|
|
Any chance you know which function is that? I am searching for it I can't find it.
There aren't too many DrawDragRect example floating around on the net.
|
|
|
|
|
I'm trying to print an image with DrawImage (GDI+ library).
graphics.DrawImage(pImage, rfDraw, rfPic.X, rfPic.Y, rfPic.Width, rfPic.Height, UnitPixel);
The graphics object is constructed with a printer device context.
The <rect>rfPic rectangle is the source area to draw from, e.g. (0, 0, 1000, 800) pixels. The rfDraw rectangle is the destination area to draw to, e.g. (100, 100, 6100, 4900) pixels. On a 600 x 600 dpi printer, this should result in a 10 x 8 inch image.
However, the image is blown up to gigantic proportions, so I only see a small magnified portion of the image. Can someone tell me why?
Drawing to screen works fine (same code, different values). I tried other unit values, setting the page scale and a lot of other things. No luck.
Can someone help me please?
Thanks,
giannibal
|
|
|
|
|
Hi,
I have a pointer to some raw pixel data and I'd like to display it to the screen and then allow the user to click on a point and get the image's pixel coordinates of the mouse click. Also because the images are big I'd like to have a scroll bar so that you can show a 1:1 image in a smaller window. Also ideally i'd like the window doing this to be a dialog in modal mode.
I can use the WM_PAINT message with SetDIBitesToDevice(...) in WM_PAINT of a dialog box to solve some of those problems, however then I don't get the scroll bars. I tried creating my own control from:
http://www.codeproject.com/miscctrl/customcontrol.asp[^]
tutorial, but it's not going too well and I realized that implementing my own scroll bars will be hard.
Any help is appreciated.
|
|
|
|
|
|
There is no compression on an 8 bit image, but it is paletized. Do you have a palette in your data ? If not, then that will be the problem. Can you do other 8 bit or less images OK ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Turn your bits into a DIBSection, then just draw that to the screen in WM_PAINT, taking into account the positions of the scroll bars.
also take the scroll positions into account when a user clicks.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
I'm basically trying to output *.ppm and *.pgm files. The file format of ppm is a simple header followed by 24 bits for RGB for each pixel. For the pgm it's a simple header followed by 8 bits per pixel.
I can read and display the ppm files using this bit of code:
<br />
BITMAPINFO bi ;<br />
bi.bmiHeader.biSize = sizeof( BITMAPINFOHEADER );<br />
bi.bmiHeader.biWidth = m_nWidth;<br />
bi.bmiHeader.biHeight = -m_nHeight;
bi.bmiHeader.biPlanes = 1;<br />
bi.bmiHeader.biBitCount = 24;<br />
bi.bmiHeader.biCompression = BI_RGB;<br />
bi.bmiHeader.biSizeImage = ::abs( m_nWidth*m_nHeight ) * 3;<br />
bi.bmiHeader.biXPelsPerMeter = 100;<br />
bi.bmiHeader.biYPelsPerMeter = 100;<br />
bi.bmiHeader.biClrUsed = 0;<br />
bi.bmiHeader.biClrImportant = 0;<br />
<br />
::SetDIBitsToDevice(<br />
dc.GetSafeHdc(),<br />
0, <br />
0,<br />
m_nWidth, <br />
m_nHeight,<br />
0, <br />
0,<br />
0, <br />
m_nHeight,<br />
m_pImage, <br />
&bi, <br />
DIB_RGB_COLORS );<br />
However this doesn't work for the pgm images. I don't know what header to set or how to display it unless I physically take the data I loaded in the pointer and insert R=G=B=original grayscale data.
|
|
|
|
|
Hi Guys
I want to prevent my app getting terminated by the taskmanager. I saw some examples but they are using dlls that you have to pay for. So I informed myself a bit about that. I figured out that i've to use SetWindowHookEx. And there we are at my first problem: What type of Hook should i use ? i prefered WH_CALLWNDPROC. And how do i have to realize the main loop ? Is it a function that i get with the hook ? I'm never used hooks before, but i'm sure with some help i could do it.
MFG
RedDragon
P.S.: The code will never be used to cause any damage to hard- or software. I'm working on a program which controls pupil pc's.
Unix and C are the ultimate computer viruses.
|
|
|
|
|
|
Yeah i see. I read this articles, too. But it is POSSIBLE. A programmer already done so. You can find the demo app on: http://www.madexcept.com/ under c++ and then go to MadCodeHook. Yeah you can come with this argument: Why don't you even this code ? Well, how could i get better when i just copy or use dlls from others ?
MFG
RedDragon
P.S: Excuse my bad english
Unix and C are the ultimate computer viruses.
Visit me: www.programming.info.ms
|
|
|
|
|
If your application is has a window, use classview and add the windows message handler: OnQueryEndSession. In the body, return false, and your application will prevent any shutdown that does not use the EWX_FORCE switch.
Himanshu
|
|
|
|
|
RedDragon2k wrote:
I'm working on a program which controls pupil pc's.
Have the students using accounts that do not have permission to terminate your process (which can be run under a different account).
Just about anything else is dodgy as hell, and will eventually be broken by any student worth his salt.
"The time has come," the Walrus said,
"To talk of many things..."
|
|
|
|
|
Hai All,
In my application InitInstance method the DoModal() calling of main application dialog return -1(bcoz of some loading problem). but i want to capture it and show some error mesage. But i cann't show any error message or any other dialog when it returns -1.
How i can i solve this problem.
ANyone can have any idea?
regards
Ans
|
|
|
|
|
|
AnsGe wrote:
But i cann't show any error message or any other dialog when it returns -1.
The reason is most likely here.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hai,
I tried with ur help. But my problem still remains.
If main window is successfully loaded then it is possible to show any mesagebox. But the main window Domodal() failed then it is not possible to show a MessageBox. The code snip running, but windows are not visible
Thanks
Anish
|
|
|
|
|
AnsGe wrote:
...then it is not possible to show a MessageBox.
Did you comment out the m_pMainWnd = &dlg statement in the app's InitInstance() method?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Whenever I've had DoModal() return -1 it was due to the dialog using a control whose window class wasn't registered yet. If you're running an older OS and are using any Win 95 common controls, check that you're calling InitCommonControls() in your init code.
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb
|
|
|
|
|
hai,
Thanks for ur reply.
i know the exact reason why it retuns -1. bcoz one my ocx is not installed in the machine. But i want to capture the situation and want to display error message.
I have done all hte initialisations in the InitInstance
Thanks
Ans
|
|
|
|