|
I don't have a sure-shot answer for you, but I took a look at the CWnd class and noticed that it has a couple of functions you might wanna try: ShowScrollBar and EnableScrollBarCtrl .
Regards,
Alvaro
Insanity: doing the same thing over and over again and expecting different results. - Albert Einstein
|
|
|
|
|
Hello, I'm a beginner programmer and I'd like some advice if possible.
I'm TRYING to make an application that displays a bitmap (a map) and then I want to put values on that map, values that I take from a file. This wasn't a problem till I knocked my head to screen resolution changes and screen-to-printer changes. Now this is where I want some advice. Can anyone please tell me some CDC methods to use for this ? I don't want the program made, just some advice to build upon.
How do I pDC->TextOut(100,100,"Value") without bothering about screen resolution changes and display-to-printer conversions. Do I have to take screen rect coord and then do smtg like this : pDC->TextOut(100*(screenreswidth/800),100*(screenresheight/600),"Value") after inputing the coords with the resolution of 800x600. Or, do I have to use SetMapMode(MM_....) and then the Device to Logical() method ? If that, can anyone explain the concept since i'm not english and It's a litte difficult to translate (conceptually) device to logical. An example perhaps ?
And then, the screen-to-printer conversion problem. Is it absolutely necessary to calculate the screen-to-printer scale and then x*scale and y*scale. If so, it's a lot of work to do cause I have to display values for over a hundred cities on the map.
What can I do ?
Thank you !
|
|
|
|
|
you wish to draw text on the bitmap right??? You can try CMemBm class in codeproject.
|
|
|
|
|
No, I dont't wanna draw on the bitmap, I wanna TextOut some values and I needed advice for coordinates transformation which I can't get so easy.
The CMemBm class, from what I've seen it's just for drawing, so it's not helpfull.
|
|
|
|
|
|
Open the Quick watch window and in the edit box enter the function name (i.e. myfunc (0) ). Most likely will not work.
Best regards,
Alexandru Savescu
|
|
|
|
|
This is my third post now, can't anyone help me? I would like to know how to close/open a DeskBand from another process. Also why does explorer hang on to your deskband when it is closed? Am I doing something wrong? When I close my deskband, I can't delete the dll because explorer keeps it open.
If you know anything about this please help.
Thanks
|
|
|
|
|
The reason why IE is holding on to your DLL is because you have not properly destroyed all of your COM objects. There is a reference count in the object server of your DLL that keeps track of how many objects that are still active. And there is a function call DLLCanUnloadNow that lets OLE know if it can unload your DLL. This function will not let the owner process unload the DLL as long as there are outstanding objects.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Thanks, I knew this, but the other posts have confirmed my fears.
|
|
|
|
|
Explorer hangs onto the DLL whether the bar is actually open or not; you'll need to kill explorer.exe (or log off) to modify the DLL. I seem to remember hearing about a way to disable this, but can't bring it to mind right now... maybe TweakUI?
That's the extent of my knowlege; there are several articles on the subject here though; do a search for "explorer bar" and see what comes up.
---Shog9---
From now on we can call C# and MC++ "The square wheel languages" -- Jack Handy, The Lounge
|
|
|
|
|
IIRC it's the AlwaysUnloadDLL registry key.
|
|
|
|
|
I couldn't find this key I'll have to look further for the location. Although its a start, it's not the solution I want, I guess I can't change how they implemented it so I'll just have my install reboot the machine when updating.
|
|
|
|
|
Thank you for replying. I was afraid someone was going to tell me this. I don't understand why they do this other than as an optimization. It doesn't save that much time and they are just using more memory.
|
|
|
|
|
Does anyone have a list of CP web services - you know, the CP URLs ending in ".xml"? I could've sworn I saw at least one reference (the last "n" posted articles service), but it was 4am and I was fading. I didn't save the link and am now kicking myself.
Thanks,
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
|
Ah, that was it! Thanks, Rama!
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
By the way did you see my screen saver using your WebResourceProvider thru C#. Thanks for WRP.
|
|
|
|
|
Yes! You did a great job of wrapping it for C# use! As soon as Tom's book shows up at my doorstep, I'll start learning C#. I feel so... oh, what's the word I'm looking for... "STUPID"! that's it!
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I'm still pretty new to GDI programming, but it was my understanding that as long as I select the original GDI object back into the DC, the resource would be cleaned up properly when it goes out of scope ( I am not using pointers for these objects ). What I don't understand is why the GDI resouce count ( in the Task manager under Windows 2000 ) shows the GDI resouces growing to an unmanageable amount in a very short period of time ( e.g. 2,000 in under a minute of program execution ).
Here's what I've done. I have a multi-threaded application that draws bar graphs to the screen (among other things, but we'll just focus on the bar graphs). One thread reads data from the serial port and writes it to a global data structure. A draw thread then gets notified that it has updating to do and it reads data from that data structure. That draw thread then calls Draw() on a global bar graph container object.
I have created a bar graph library that abstracts the bar graph functionality. The container class I mentioned above (CObject inherited), holds four bar graphs and is responsible to update internal data of each of the graphs. One of these container objects is used throughout the program and is global. I call Draw() on this container class (passing it a DC) both in the view's OnDraw and also in a secondary draw thread (as mentioned above) (CWinThread inherited). I synchronize access with a critical section. I think that the problem is in this global class.
Is there something about global classes that I am not taking into account here when it comes to GDI? My GDI objects that I create are created in the scope of the function (method) and not in the the class scope (e.g. m_gdiObjectName ).
Any suggestions would be helpful ( I hope I've been clear enough ).
Thanks.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
For all of the GDI objects that you create, are you calling DeleteObject on them, and DeleteDC or ReleaseDC for the device contexts that you create.
Because part of allowing the GDI objects to properly destroy is to replace the original objects into the DC, because this frees the objects that you created to be properly destroyed.
You should always destroy the objects that you explicitly create.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
According to the GDI source code, the destructor of each of the GDI objects should be doing this for me. The destructor calls this:
BOOL CGdiObject::DeleteObject()
{
if (m_hObject == NULL)
return FALSE;
return ::DeleteObject(Detach());
}
My objects are all created without using new and should be destroyed when they go out of scope. It doesn't appear that they are.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Sorry, I forgot that you were using GDI wrapper objects. So if you set a break point in the destructor for your objects, are the objects being deleted properly?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Yep. They're getting deleted. I'm stumped here.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
I want to use CSockets to send a file(text file) across a network. One program is the server, and the other is client(of course). What is the easiest way to do this?
|
|
|
|
|
Microsoft has a really good example of this. Go to http://support.microsoft.com/default.aspx?scid=kb;EN-US;q175668. This example will work running both client an server on the same machine, but you could very well move the server to another machine on your network and see it work over a network.
Best Regards and good luck.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|