|
Now i am diong a project using vc++
there is need to draw graph using random access values from database.
julie
|
|
|
|
|
See Here[^]
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
i am working with Active-x test container in that i have add control through edit,now i am able to get connected with server with invoke function>My Q is :
1.if i want to save my userid and password in that for future use is that possible.
2. when i get connected to server it is giving me a "session id" and each time it will b new one
so if i want to use that session id for further procedure like "request Price" etc without
user interface how it can b done.
3.Is it possible to invoke more then 1 or 2 function from test container.
any suggestion will b helpful to me.
Thanks
|
|
|
|
|
Instead of using Test Container, I would probably write a simple test application that uses the Active-X control, then you can get/set properties, invoke methods, and put the control through rigorous testing.
At least that's how I would do it.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
can u tell me how???i will try through your style
|
|
|
|
|
I just have to ask...if you're not writing an application, what exactly are you planning to do with the ActiveX control?! (i.e. why do you need to test it?)
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
I can select records using
SELECT * FROM MyTable WHERE MyColumn LIKE ‘A%’
But it is case insensitive and it selects all the records which begin with ‘A’ and ‘a’
Is there any way to write it, to be case sensitive?
I want to select the records which begin with ‘A’ only, not ‘a’
Thank you
|
|
|
|
|
Probably a good question for the SQL / ADO / ADO.NET forum...so I'm just guessing, but I think that's just the way sql and access work. You could filter it out with code, when you loop through your recordset.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
This question is for VC or sql?
|
|
|
|
|
For SQL. I put this question here to get quick response.
|
|
|
|
|
How about:
SELECT * FROM MyTable WHERE UPPER(MyColumn) LIKE ‘A%’
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello all,
I am trying to assign a Dialogbox resource to a custom dialogbox class... specifically Anna Meltcafe's CNGWizard (Resizable Wizard)
To be very specific, I have to make my PropertySheet belong to CNGWizard class and PropertyPages to CNGWizardPage class.
The problem is, I cannot locate CNGWizard nor CNGWizardPage in ClassWizard under MFC ClassWizard as the base class of the dialog.
It shows me CPropertyPage just fine, but does not have CPropertyPageEx !
I thought the .clw files had got corrupted again and rebuilt it, but CNGWizardPage nor CNGWizard appears in the controls list of the ClassWizard's "New Class" dialog...
I admit to never trying to use custom dialogbox classes before - but I have used custom controls a lot and custom control classnames showup in the ClassWizard just fine ?
I am using Visual C++ 6.0, SP5
-- modified at 22:03 Tuesday 25th July, 2006
|
|
|
|
|
As far as i can tell only the MFC base classes are listed in the wizard.
just derive the dialog from CDialog, include the cngwizard header, and change the
"class classname: public CDialog {"
to
"class classname: public CNGWizard {"
i have only ever replaced CDialog with base classes derived from CDialog.
|
|
|
|
|
Hey,
I have been converting a application from watcom/dos4gw/metagraphics over to vc++/MFC. i should mention that before i started (6 months ago) i had only programmed in basic and didn't understand c/c++ at all.
The program used to create a 3D model stored in an array, and then rendered it to the screen using a simple wireframe view and a sloooow BSP routine.
the hiddenline(BSP) functions are taken from a book written in the 80's and they are a complete mess, and for some reason run like 3/4 times slower on a 1500mhz windows machine than on a 350mhz DOS laptop?!? so anyway, instead of trying to understand this sytem and then converting it, i have created a DirectX Vertice buffer directly from the raw model Polygons. To create the buffers i adapted the old triangulation function to work with my data (without fully understanding it!), and then adapted a vector normal calculation routine from another (working) application.
To get a polygon triangulated correctly i have to rotate it twice, yaw then pitch, before the triangulation function finds any triangles, this is a copy of the vertice buffer the original is left unrotated. the function creates an array of triangles{A,B,C} that link to the vertice buffers. the vector normals are then calculated for each point in each triangle and a DX buffer is created.
After alot of hair pulling i finally got this to work however....
The Z buffer operation never works properly, objects behind are partially shown in front of other objects. i have tried all modes.
The Backface culling mostly works but removes some polygons that it shouldn't.
The lighting/shading is in oppposite directions for triangles in the same polygon.
Picture : http://www.rayevansengineering.com/Surreal/Conservatory.jpg[^]
I have no idea where the problem lies at the moment, after reading some stuff around the net i suspect it has something to do with the vector normals. or is it the fact that the point buffers are rotated for triangulation but not for rendering? maybe the triangulation function is arranging the points in some weird order?
Am i missing something else entirely? do the triangles in a polygon need merging somehow when creating the normals?
VECTOR NORMAL ROUTINE
vector1=pVertices[nOrigin].p-pVertices[nOrigin+1].p;<br />
vector2=pVertices[nOrigin].p-pVertices[nOrigin+2].p;<br />
D3DXVec3Cross(&temp,&vector1,&vector2);<br />
D3DXVec3Normalize(&pVertices[nOrigin].normal,&temp);<br />
<br />
pVertices[nOrigin+1].normal=pVertices[nOrigin].normal;<br />
pVertices[nOrigin+2].normal=pVertices[nOrigin].normal;<br />
<br />
PRE TRIANGULATION ROTATE
ang=geo.AngleXZ(newpoly.m_coord[p1],newpoly.m_coord[p2]);<br />
for (a=0;a<newpoly.m_npoints;a++) <br />
newpoly.m_coord[a].Rotate(newpoly.m_coord[p1],0,0,-ang,newpoly.m_coord[a]);<br />
pitch=atan2((newpoly.m_coord[p3].y-newpoly.m_coord[p2].y),(newpoly.m_coord[p2].z-newpoly.m_coord[p3].z))/RAD;<br />
pitch=-(90-pitch); <br />
for (a=0;a<newpoly.m_npoints;a++) <br />
newpoly.m_coord[a].Rotate(newpoly.m_coord[p1],pitch,0,0,newpoly.m_coord[a]);<br />
THE TRIANGULATION ROUTINE
[made the message huge] - can post if needed
-- modified at 21:38 Tuesday 25th July, 2006
|
|
|
|
|
Gnarley post! My first inkling would be that your triangles aren't drawn in the right order, i.e. clockwise or counter-clockwise, so maybe your Pre Triangulation Rotation function is suspect.
Don't know DirectX either, but in OpenGL, you can use the glRotate function to modify the current matrix, and then draw the object normally, without having to update the individual object vertices.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
i think you may be right. without rotating most of the polygons are clockwise and the triangulation function can't handle them(finds 0 triangules). that must mean that the rotations turn them counter-clockwise. the vertice buffer is copied to do the triangulation so the original polygons are left clockwise. So i guess Direct X is then rendering counter-clockwise triangle points linked to (wholly or partially)clockwise polygon coordinates.. hhmmmm...
|
|
|
|
|
I have some drawing code that seems to work *most of the time*. Trying to use some of this code today, I've encountered all sorts of odd behavior, and I'm questioning how I originally implemented this code. What I need from people who are deeper into Windows than I is the "why" of how painting/drawing in Windows actually works.
My app is dialog based. Some of the dialogs have to update graphics as fast as reasonably possible. So, early in my Windows development curve, I crafted my solution like so:
myclassdlg::OnInitDlg()
{
// set everything up...
// start a timer...
SetTimer (999, 500, NULL); // every 500ms
}
myclassdlg::OnTimer()
{
// do all of my drawing.
}
Now, based on various bits and pieces I've pulled together, this is just the wrong way to go about it. Unfortunately, it worked the first time, for whatever reason, and I've continued on my perilous ways. Well, now I've run into a problem, my new drawing code (based on the above style) doesn't work, so in my research, it appears that the correct way to do things is to start the timer but in the OnTimer loop, add an UpdateWindow() call to trigger the WM_PAINT message. The OnPaint handler than executes whatever drawing is necessary.
First question: do I have this right?
Second question: assuming I have this correct, what does the "draw in the OnPaint handler" apprach imply? It would seem that "this is the way you do it", but why? Does Windows do something special such that the graphics are guaranteed to draw?
Still getting my arms around this beast called Windows.
Charlie Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
My son's PDA is an M249 SAW.
|
|
|
|
|
Im no expert but I think using the timer is incorrect. Have a look at these functions /messages in MSDN
InvalidateRgn
WM_ERASEBKGND
WM_PAINT
The idea is that when something changes that requires the graphics to change you call invalidate region to tell windows that this area of the screen/window in now out of date. Windows sends the WM_PAINT and WM_ERASEBKGND message as part of the screen painting process but if you attempt to paint to the screen outside of this process unexpected results can occur.
Objects in mirror are closer than they appear
|
|
|
|
|
You're right in that OnTimer() shouldn't do drawing, but should call an API that will trigger a repaint. RedrawWindow() will cause the whole window to be redrawn, that's the quickest way, although not the best if your painting takes a while.
The reason why is because Windows keeps some data about each window that indicates which part is "invalid" - meaning it needs to be redrawn. BeginPaint /EndPaint - which you call indirectly by using a CPaintDC object - do the bookkeeping that updates that data. If you just paint in some other random message handler, what you draw will get wiped out if another window covers yours.
So it's not so much that Windows guarantees that graphics will be drawn, but it guarantees that you will be notified (via WM_ERASEBKGND and WM_PAINT ) when some part of the window has been uncovered, which is when you decide what to draw.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Josh/Mike,
Okay, pieces are coming together. But, to belabor the point (because I really want to understand), Josh, could you elaborate on "but it guarantees that you will be notified" in the context of dialog/window creation? My perception is that sometimes my OnTimer approach works just fine, while at rare times I get nothing... or the wrong results.
Charlie Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
My son's PDA is an M249 SAW.
|
|
|
|
|
You could try this experiment. Set the timer interval to a larger value, say 5 seconds SetTimer (999, 5000, NULL); . Then take a smaller window and move across your window a few times.
When your window is being uncovered as you drag that smaller window, windows will notify you using WM_PAINT that you need to redraw a portion of your window (the invalidated portion). Windows doesn't remember how your window is painted (ie. doesn't store what you painted previously), so it has to ask you.
|
|
|
|
|
hfry,
I don't seem to be communicating clearly - sleep deprevation most likely. I understand your test case. As I move windows, paint events should arrive. I understand this. What I'm trying to get a handle on is the dialog creation / paint notification sequence of events. Why such a restrictive situation you ask? The answer lies in my target application - it is a touchscreen and all window navigation is under program control.
In my specific situation, I create my dialog and initiate periodic updates to the screen. 99% of the time, this works like a charm. I happen to be in the 1% zone, and the window just won't paint correctly. I've reduced my code to attempting to blit a single, red-filled bitmap. The code is below. What I see on the dialog is WHITE when the red should be. If I change the FillRect call to go directly to the dialog DC, it draws correctly.
In my dialog, I do this:
OnPaint()
{
//CPaintDC dc(this); // don't need this, let drawing class deal with it.
UpdateDisplayData(); // Render the graphics.
}
....
In the drawing code (no, the class' name is not this silly...), I have culled out 99% of my code, reducing it to a single bitmap fill and blt:
CDisplayData::UpdateDisplayData()
{
CPaintDC dcDialog(m_pParentWindow);
CDC dcBitmap;
BOOL bStatus = dcBitmap.CreateCompatibleDC(&dcDialog);
ASSERT (bStatus);
CBitmap buffer_bm;
CBitmap *old_bm;
// Create an offscreen bitmap for antiflicker buffering...
bStatus = buffer_bm.CreateCompatibleBitmap(&dcBitmap, 100, 100);
ASSERT (bStatus);
old_bm = dcBitmap.SelectObject(&buffer_bm);
// Fill the bitmap with an arbitrary color, and copy it to the screen.
// "RED" is a macro...
dcBitmap.FillSolidRect(0, 0, 500, 100, RED);
bStatus = dcDialog.BitBlt(rc.left,
rc.top,
rc.Width(),
rc.Height(),
&dcBitmap, 0, 0, SRCCOPY);
dcBitmap.SelectObject(old_bm);
}
-- modified at 7:17 Wednesday 26th July, 2006
|
|
|
|
|
charlieg wrote: I'm trying to get a handle on is the dialog creation / paint notification sequence of events
I'm actually not too sure what you mean by this.
charlieg wrote: What I see on the dialog is WHITE when the red should be.
I suspect that that is because you are not handling WM_ERASEBKGND and the default handler is drawing the background (using the background brush which is usually COLOR_WINDOW which is usually white). And that it's not painting red because that region was not invalidated. This is of course just a guess, from the available code.
I notice you are double buffering to reduce flickering. Are you also handling WM_ERASEBKGND and doing nothing but returning 1? Are you "erasing" your window in your UpdateDisplayData() function (bitblting the background color)? Or is this not neccessary in your case.
In your OnTimer handler, do you invalidate the part of your window that needs to be redrawn (or the whole client area if that is the case)? You shouldn't be calling UpdateDisplayData() in your OnTimer handler as CPaintDC (BeginPaint()/EndPaint()) should only be used in response to a WM_PAINT message.
Windows maintains the clip region for your window when you need to do your painting, so if you don't have anything within the clip region (ie. didn't invalidate explicitly or windows didn't invalidate anything for you) then it's not going to actually draw anything to the screen.
|
|
|
|
|
hfry,
hfry wrote: I'm actually not too sure what you mean by this.
What I'm trying to understand is the initial dialog/window creation sequence and the ramifications on drawing. In a galaxy far away called Unix, they have this beast called X-Windows. A drawing 101 error was trying to draw before something called an expose event. Drawing before this results in all of the drawing going into the bit bucket. Fast forward to today - Windows has it's own little mechanism called the invalid region - if you don't invalidate things, they won't draw. Now, most of my drawing codes does not invalidate anything, it just starts blasting away, and the images show up. My theory is that when a dialog/window is created, everything is invalid, and my drawing appears... just a theory. So, that's why I'm asking how things really work - maybe there is something more subtle.
Okay, so getting to your specific comments:
1) WM_ERASEBKGND - with a couple of very unique situations, I never handle this.
My drawing code regenerates the image in a bitmap. The BitBlt then replaces
the entire region on the window. My rationale was, why bother to erase
something that I'm getting ready to paint over?
FWIW: I added a handler for this message - no effect.
2) As far as "erasing my window" - I simply call InvalidateRect with the same
CRect that I use in the drawing code. Note this this is just the test code
I'm running now. Usually, I do not do an invalidate operation, electing to
draw out of the OnTimer handler. Both *seem* to work (but I have my doubts
).
Even with relocating the code to the OnPaint handler, the only time the
screen is updated correctly is when I draw directly to it. If I use the
code to fill a bitmap then blit the bitmap, I get white.
I truly appreciate your suggestions and patience. This issue has me a bit
Charlie Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
My son's PDA is an M249 SAW.
|
|
|
|
|
OMG!!!
I just found it, and I understand why superficially, but I think my way should have worked. Ignore all the onpaint comments, not directly relevent to the behavior at hand.
Broken code / working code is bolded below.... Now, does someone want to explain to me why I have to create a compatible bitmap from the PaintDC? Is it not logical that if I create a buffering DC with CreateCompatibleDC(PaintDC) should not a bitmap created be compatible as well?
CDisplayData::UpdateDisplayData()
{
CPaintDC dcDialog(m_pParentWindow);
CDC dcBitmap;
BOOL bStatus = dcBitmap.CreateCompatibleDC(&dcDialog);
ASSERT (bStatus);
CBitmap buffer_bm;
CBitmap *old_bm;
// Create an offscreen bitmap for antiflicker buffering...
bStatus = buffer_bm.CreateCompatibleBitmap(&dcBitmap, 100, 100);
bStatus = buffer_bm.CreateCompatibleBitmap(&dcDialog, 100, 100); // this works
ASSERT (bStatus);
old_bm = dcBitmap.SelectObject(&buffer_bm);
// Fill the bitmap with an arbitrary color, and copy it to the screen.
// "RED" is a macro...
dcBitmap.FillSolidRect(0, 0, 500, 100, RED);
bStatus = dcDialog.BitBlt(rc.left,
rc.top,
rc.Width(),
rc.Height(),
&dcBitmap, 0, 0, SRCCOPY);
dcBitmap.SelectObject(old_bm);
}
Charlie Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
My son's PDA is an M249 SAW.
|
|
|
|
|