|
I wanted to draw a 256 color bitmap from a resource to a view window but i was wondering how i can do that ??????????????????
|
|
|
|
|
Have a look at this article.
http://www.codeguru.com/Cpp/G-M/bitmap/article.php/c1721/
|
|
|
|
|
i have already seen that article and used it in my code but the line
if( dc.GetDeviceCaps(RASTERCAPS) & RC_PALETTE && palette.m_hObject != NULL )
{
dc.SelectPalette( &palette, FALSE );
dc.RealizePalette();
}
the evaluation in the if statement is always NULL and nothing is drawn on the screen i am drawing in the CView::OnDraw() function and i created one class storing the bitmap and palette all together and some operations as loading image generating the palette and so on but nothing is drawn
|
|
|
|
|
CDC *dc = GetDC();
CDC memDC;
memDC.CreateCompatibleDC( dc );
CBitmap bitmap;
CPalette palette;
GetBitmapAndPalette( IDB_BITMAP, bitmap, palette );
memDC.SelectObject( &bitmap );
// Select and realize the palette
if( dc->GetDeviceCaps(RASTERCAPS) & RC_PALETTE && palette.m_hObject != NULL )
{
dc->SelectPalette( &palette, FALSE );
dc->RealizePalette();
}
dc->BitBlt(0, 0, 180, 180, &memDC, 0, 0,SRCCOPY);
This is working
|
|
|
|
|
How to define a specific dialog window dimensions when the application (dialog based) starts?
I could 't find such property in the property tabs.
Please help
|
|
|
|
|
Try SetWindowPos() or MoveWindow() .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Try SetWindowPos
Artificial intelligence is no match for natural
stupidity.
|
|
|
|
|
Just started build test apps with VC++.Net and I have a few silly questions?
1. I need to write dynamic/data access web pages and I am not sure exactly what project type to use (so many!), I am currently building test apps in the 'Windows Forms Application .Net' project type, am I ok?
2. I would like to put a simple button on a web page (I have Dreamweaver etc) click it and my window pop up? not sure how I take the .exe file generated and actually get this to happen? think its something to do with XML and the XML file writing/reading classes?
3. Thanks a lot? I appreciate all help and value it!
Many thanks for your time and may the force be with you! (you'll need it!)
|
|
|
|
|
1. Use the PHP language. Search Google with "Data access with PHP". PHP scripts can be written directly into a HTML document, thus allowing access to a database directly.
2. The button click usually causes a script event. If you are using JavaScript, then here is a piece of code that starts a program on the machine:
function openNotepad() {<DIV>
var oShell = new ActiveXObject("Shell.Application");
var commandtoRun = "C:\\Program Files\\Microsoft Office\\Office\\WINPROJ.EXE";
var commandParms = "C:/Filename.mpp";<DIV>
oShell.ShellExecute(commandtoRun, commandParms, "", "open", "1")
} Just change the path to point to your executable and omit the parameters. See ShellExecute in JavaScript reference for more information. It might be that this will not work, as it is a security risk to allow scripts to execute applications (Think about executing "format c: /y"). An another alternative is to fire an open/save dialog.
If you only need to open a window/dialog, then you shouldn't use an executable at all. I think Dreamweaver has the tools to write a Flash component that acts like a window, showing buttons, getting results and so forth. Then just insert this component into the web page.
Hope these will help.. If not, then post more information on your problem, and consider if there are any alternatives available, mostly due to the insecurities in script-based command execution.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hi!
I'm trying to write my own HTTP server in Win32API, with the Winsocks API.
For the moment, it can read the GET and HEAD methods, so I can handle basic HTML and JavaScripts which don't tell data to the server.
To to this, I would like to use the POST method, but I don't know how to use it.
It would be great if you could send me documentation about POST and other specifications about HTTP methos (with samples if possible)
Thanks !
Time doesn't waits
|
|
|
|
|
You can go through the HTTP RFC's[^]
As far as I know... GET appends the data (Form fields) to the URL (as in xyz.html?s=y... etc)
POST appends the fieldname and value to the end of the request data... so look for (\n\n) and see if you have any fields.
I hope this helps
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
"Philosophy is a study that lets us be unhappy more intelligently."
-Anon.
|
|
|
|
|
Hai,
I'm creating a dialog-based app in win32 vc++. After starting the app,if there is no user activity for 10 sec the app should exit...Can anyone suggest how to do this.
thanks.
|
|
|
|
|
Use a timer to increment a counter every second, when the counter hits 10 call EndDialog. At the same time have every possible user input action reset the counter to 0.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
cse WM_INITDIALOG:
SetTimer();
break
case WM_TIMER:
EndDialog();
break;
And when a button is pressed the timer should pe set again or whatever you want tpo do
gabby
|
|
|
|
|
Sorry to take up for forum space here!
Many thanks for your time and may the force be with you! (you'll need it!)
|
|
|
|
|
If it is just a regular C/C++ question, this forum will do fine. If it is a question regarding managed extensions and the .Net runtime then use the Managed C++ forum[^]
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Forget it, I have just woke up!
Many thanks for your time and may the force be with you! (you'll need it!)
|
|
|
|
|
Is there any way to turn off warnings for visual studio headers while still keeping a high warning level on your project code? I looked briefly in the forums but couldn't find anything that specifically applies.
|
|
|
|
|
Use the #pragma warning directives.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
You can also modify the warning level for particular source files, if there is one that causes you consternation. I often do this when dealing with 3rd party files that I have no control over.
|
|
|
|
|
I use warning level 4, and don't see warnings out of the 'visual studio headers'. What kind of warnings are you seeing, and which compiler (VC6, VS.NET 2002, VS.NET 2003) are you using?
Software Zen: delete this;
|
|
|
|
|
Sorry, I guess I wasn't specific enough. VC6 compiler. The warnings are usually like this;
c:\program files\microsoft visual studio\vc98\include\xmemory(39) : warning C4100: '_P' : unreferenced formal parameter<br />
c:\program files\microsoft visual studio\vc98\include\xmemory(41) : warning C4100: '_P' : unreferenced formal parameter<br />
c:\program files\microsoft visual studio\vc98\include\vector(249) : warning C4663: C++ language change: to explicitly specialize class template 'vector' use the following syntax:<br />
template<> class vector<bool,class std::allocator<unsigned int> > ...
I'm also getting alot of signed/unsigned mismatches and casting warnings. It's ok though, I just modified the offending files with pragma
directive and everything seems to be working fine.
Thanks!
Brent
|
|
|
|
|
I have a MDI application with a customized toolbar. This toolbar has up to 4 edit boxes (command profile configurable) that get updated and provide feedback of geo-coordinates(MTM, UTM, Lat/Long,etc). I have noticed that my toolbar works fine until I add another toolbar to the app. The other toolbars are not dynamic in nature like the coordinate toolbar, so it really shouldn't hit the performance of the coordinate toolbar's editbox updates, but it does. The update of the coordinate toolbar's editboxes are driven by mouse movements(OnMouseMove). Any ideas? Thanks!
|
|
|
|
|
OnUpdate handlers are called for each toolbar button during idle processing etc. You need to keep the amount of time each handler spends doing whatever it does to a minimum.
If your the calc's for your edit boxes take too long you will see sluggish performance. Mousemoves can be sent with the same coordinates as the previous call. You should check if they've changed and if not do zip.
Also look at profiling your code. I personally like Glowcode www.glowcode.com[^]
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
Looks okay.
Does it initialize if the calls to AddString() were commented out?
Kuphryn
|
|
|
|