|
CPaintDC dc(this);
HBITMAP hbitmap =
::LoadBitmap(::AfxGetInstanceHandle(),
MAKEINTRESOURCE(IDB_TEST));
HDC hMemDC = ::CreateCompatibleDC(NULL);
SelectObject(hMemDC,hbitmap);
::StretchBlt(dc.m_hDC, 33, 22, 10, 3, hMemDC, 0, 0, 6, 6,SRCCOPY);
::DeleteDC(hMemDC);
::DeleteObject(hbitmap);
This paints a bitmap image on the dialog, but what about icons??? Can i change this code
so it paints a icon instead of a bitmap??? if so how??
Thank you..
|
|
|
|
|
If you look in your OnPaint for any dialog based app you may have written, you'll find this:
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
So it would appear you can draw an icon into a DC and then stretch it into another, if you so desire.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Dear all,
I'm a junior developer writing mixed C/C++ based applications in Windows (using the VC++ command line tools, but not the DevStudio GUI). One of the question that I have the most trouble understanding is how does the build process really works. What is a precompiled header file? What's the difference between an .obj, a .dll, and a .lib file? How is an export table defined? How do a link all the .lib and .dll file together to make an executable? In many occasions it takes much more time finding out how to build and link properly than the actual coding part. I'm sure there are a lot more questions of this kind that are alluding junior developers everyday, since no good books are available and websites on the Internet (like CodeProject) rarely mentions anything on this subject. The MSDN website has a big chunk of reference manuals online about Compiling and Linking, but it offers almost little help for beginners who tries to learn this subject. Can anyone point me to some useful printed or Internet resources available? I'm hoping that someone in the CodeProject community can write an article on this subject too Thanks.
|
|
|
|
|
For a bit of a learning experience, try using the DevStudio GUI for a project and have a peek into the .DSP file (most of the commands for compile/link are there) or alternatively have the GUI export a makefile for you and inspect that one instead. It won't answer all your questions, but it should answer some of them.
Chris
|
|
|
|
|
I have developed a keyboard for the screen, but I need to send the keystrokes
to the application like MS Word. Right now the keyboard is in a floating window
capturing the mouse input but I want to send keystrokes to the other application,
ie. have another application capture the keystrokes even though it does not have
focus.
Is there a way of having the keyboard on top, getting mouse events but not taking
focus?
How do I send keyboard events to another application/window?
Please email me...dostie@nettaxi.com
THANKS!
|
|
|
|
|
Hi All,
I have to implement an SNMP extention Agent in W2000. It is based on a DLL which will be loaded by SNMP Agent. This DLL must communicate with a 16 bit APP to update the MIB handled by the DLL. I used :
- SendMessage() to communicate from the DLL to the 16 bit App.
- Generic thunk to invoke the DLL from the 16 bit App.
My problem is :
When I start the service SNMP in dos command by "snmp.exe" all is all right. But if I start the service by "net start snmp" the two process (DLL and 16 bit app) don't communicate. (FindWindow() to use with SendMessage() return WND=NULL and Generic thunk (CallProc32W()) crashs the 16 bit App and even Visual 1.52)
To make the Generic Thunk and FindWindow() work, it seems that the service must be attached to a window
Someone with an idea ?
Thanks for yor HELP
Mouez
|
|
|
|
|
Yes, I don't think you'll be able to use FindWindow - the windows reside on two different 'desktops' for want of a better model.
One idea for communicating with services is for both the DLL and the .exe to use a socket to communicate - probably a simple UDP setup is all you need. Use the loopback (localhost 127.0.0.1) for the address for the sendto , and pick a couple of unused ports to bind to.
A nice touch would be using async sockets, so your app and DLL aren't polling.
|
|
|
|
|
Hi All,
Been stuck with this problem for quite sometime now, tried some other discussion group - no help, hope someone here can help me....
I would like to launch a CMiniFrameWnd/CDocument/CView derived objects from a Dialog based program (Doc/View was not selected during AppWizard).This window is a floating window above MyDialog and contains all the built-in Doc/View architecture when launched. This is what I have done up to now:-
BOOL CTestApp::InitInstance()
{
Other stuffs.....
CSingleDoctemplate* pDocTemplate;
pDocTemplate=new CSingleDocTemplate(
IDR_MINIFRAME, // I also have a problem understanding the string
// resource needed for this value here, no menu,
// no icon
RUNTIME_CLASS(CMyDoc),
RUNTIME_CLASS(CMyMiniFrame),
RUNTIME_CLASS(CMyView));
AddDocTemplate(pDocTemplate);
CMyDlg dlg;
int nResponse=dlg.DoModal();
etc etc
}
void CMyDlg::OnButton1()
{
// Here is where I would like to launch my floating Doc/View Frame
// I have no idea how to do it......
}
Thanks For any help
Mustafa
|
|
|
|
|
given that a dialog will by default be modal it will have the focus of your app until it closes ... to launch another dialog would be trivial ... launching a non-modal window would be like launching a modeless dialog as far as i can tell ... you would have to post a message to the modeless window if the modal dialog closed
also if you didn't include doc/view support during appwizard phase a lot of support code will not be included so as far as i can see you'll be doing a lot of work to get it done ... can you not structure your app differently to make life easier?
mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them
|
|
|
|
|
Installation of my machine:
-Visual C++ 6.0 enterprise edition
-Service Pack 4
-Processor Pack from Microsoft (ISSE, SSE2 support)
(-Windows 98 SE
-MSDN library
-Visual Source Safe 6.0)
Every time is start debugging on my machine with VC++6.0 debugger, I get an completely empty call stack window.
This happens always, and independantly of the project I want to debug. I have uninstalled/reinstalled VC++6.0 already,
but without success. Does anyone have a good tip for me?
|
|
|
|
|
I'll take Processor Pack for 200.
Seems to me it installs some updated DLLs - if these don't come with the same sym tables or pdbs as the regular VC stuff, that might kill the call trace.
Not sure, but have you tried uninstalling/reinstalling VC without the PP?
|
|
|
|
|
Yes, I already have tried uninstallig and reinstalling everything. I also have tired debug mode and the call stack
without the service packs and the PP - with no success.
Anyway I don't think that the PP is the problem: I have another machine configured the same, and on this everything runs well:
VC++ 6.0, Service Pack 4, PP, call stack works properly in debug mode...
I use the first machine to edit and compile the code (Win98 SE) and the second machine (Win 2000 professional) via remote debugging over LAN (TCP/IP)
tu run and test the code. But this should'nt be the reason for my problems, cause I have had this call stack problems already before using this remote
debugging combination.
|
|
|
|
|
Most likely you'll find that you are simply looking in the wrong thread. On Win2K I think you see extra threads even if your application isn't multithreaded. Use Debug|Threads to select the main thread and all should be well.
Hope that helps.
Neville Franks, Author of ED for Windows
www.getsoft.com
|
|
|
|
|
... unfortunately it didn't help ...
|
|
|
|
|
... unfortunately it didn't help ...
|
|
|
|
|
In Debug|Threads do you see more than one thread? You need to either Double click on the list item or press Set Focus before you will see the Stack Trace for the selected thread.
Neville Franks, Author of ED for Windows
www.getsoft.com
|
|
|
|
|
Yes, I see several threads; but neither double clicking nor pressing "Set focus" does help. BTW, even the context selector
(the drop down selector on top of the "Variables" debug window) is empty, i.e. doesn't contain any contexts.
|
|
|
|
|
... meanwhile I have reinstalled my machine in the following way:
* deinstall Microsoft Visual studio
* reinstalled WIN98_SE
* installed MCS
* tested debugging and call stack - no success! Call stack stays empty!
* installed service pack 4
* tested debugging and call stack - no success! Call stack stays empty!
* installed PP
* tested again with no success
Seems to be all very strange to me ...
Roland
|
|
|
|
|
Hi everyone,
I'm trying to build an activeX (ATL)witch contain a combobox.
The problem is, I can't see the strings that I add in the combobox list.
At test mode everything seem perfect, but When I insert my New control in any container there is no string inside.
I learned on another site that it is a bug, But they don't say exactly how to solve it.
I'm usign Visual C++ 6.0 to build it. This crucial for me
Please if you have any solution contact me that will appreciated.
Email: skoomson@motus.com
|
|
|
|
|
I'm trying to setup Microsoft's Intenet Connection Sharing from C++. MS
Knowledge Base article Q234815 talks about the ICS "APIs for configuration,
status and dial control for programs." However, even with MSDN, I can't find
any reference to these APIs.
Windows 98 has a DLL called icsapi32.dll and dumping the exports shows me
that these functions exist:
IcsConnect
IcsDisable
IcsDisconnect
IcsEnable
IcsEnumerateActiveMappings
IcsEnumerateClients
IcsEnumerateInstalledMappings
IcsGetAdapterList
IcsGetClientOptions
IcsGetConfiguration
IcsGetStatistics
IcsSetClientOptions
IcsSetConfiguration
IcsSetHomenetConnection
IcsSetInternetConnection
IcsSetMapping
but I can't find any doc on them. I've searched MSDN Universal,
developer.com, most of these newsgroups, and the Platform SDK header files.
They're supposed to be supported in Windows 98 Second Edition, ME, and 2000.
Does anyone have any ideas where I can find any information on these calls?
Thanks for your time.
|
|
|
|
|
I have a CButton-derived control (let's call it MyCButton) for which I am handling the painting. I do my painting in MyCButton.DrawItem().
The problem is, Windows erases MyCButton before each call to DrawItem(). That causes massive amounts of flickering.
How do I stop Windows from doing this? Are there any better ways of going about what I'm trying to do?
|
|
|
|
|
Try adding a handler for WM_ERASEBKGND . In the OnEraseBkgnd handler, do nothing - just return TRUE.
|
|
|
|
|
Is there a way to enumerate all the symbols exported by a loaded dll file?
Thanks!
|
|
|
|
|
Hello.
I'm working on an application that displays processes state. I manage to get their
handles thanks to "OpenProcess" function. Now I'd like my application to react when one of these processes terminates. How can I do ?
I understand that I probably have to implement callback functions, but how ?
Do I have to use "RegisterWaitForSingleObject" function ?
Thanks.
|
|
|
|
|
ummmm unfortunately its not so easy to get notified of things happening in other parts of the system ... thats why the process viewer in winnt polls every few seconds and gets a snapshot of whats happening
theres a styling article in an old copy of msj (jan 1999 - nerditorium) thats suggests using a fake kernel mode driver that can send notification to the user mode app across the dark divide from the kernel where it all happens (yeah yeah)
check it out ... i think it'll answer you're question
mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them
|
|
|
|