|
Try a Google search on "porttalk". It comes with some code to include in your app, and a driver. I have used this with good success on multiple XP systems.
Good luck,
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
How can I use a toolbar to suspend my thread?
|
|
|
|
|
Define a global boolean variable, inside your thread if that value is true then you can either sleep, or wait on an event otherwise you do your thread's work.
Don't use SuspendThread and other similar functions because it may mess up the thread.
|
|
|
|
|
How does SuspendThread "mess up" the thread!? Please elaborate.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
See here.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thanks David. I can see where the statement is based now.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
How to call Functions in an exe using Visual C++?
|
|
|
|
|
The same way you do with any other language (with a few exceptions). For example, if you wanted to call the MessageBox() function, you'd have:
MessageBox(hWnd, "Text", "Caption", MB_OK);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
i think if you don't know about that point, you should first learn more about the C++ language before coding further. there are many books, HTML pages (and so on...) about the subject, you will easily find what you need.
see you
TOXCCT >>> GEII power
|
|
|
|
|
i need a platform, that's appearance ought to be a little bit like IDEs such as VC6 or Ultraedit,i think i need three part in the platform.
@Left,a listcontrol that may have tabs for different sorts of files;
@Right, a View that used to display the contents of which i clicked on the left side;
@Bottom,a capture of the output when i run some command on the files.
in brief, that's the same architecture with VC6,but fortunately,i needn't build a real powerful IDE like that.
I've tried several ways to do the job, but i cannot find a MDI solutions for display more than one files i've clicked. i used to building a SDI with splitterwindow which may have the same look i expect, but i wonder if i can do it in MDI way? i need help, if someone have the free SRCs like that,Could you send it to me at josephvan@sohu.com! thanks a lot !!!
Josephvan thanks for your attention
|
|
|
|
|
search for docked views...
sorry, don't know more about that...
TOXCCT >>> GEII power
|
|
|
|
|
I wrote a sample add-in for Visual Studio Editor.
But I have to include it each time when I open MSDEV, from tools-->Customize
option. Is there any method to load it at starting up of MSDEV .
|
|
|
|
|
Macro
"Naked we come and bruised we go."
- James Douglas Morrison
Best Wishes,
ez_way
|
|
|
|
|
I am working on Dialog Based Application in which bitmap is Blitted on the Dialog bu using Device context. Bitmap is actually a World Map. I need to show blink at certain position on the map. So I have taken two more bitmaps which is a Tower shaped. One is black in color and other is red in Color. I set the timer to 500 milliseconds. For every 500 milliseconds I keep changing the Bitmap from black to red and again to black. When ever my application is running it is showing 54% of CPU usage. Please suggest me how to reduce the CPU usage.
Thanks in Advance.
Deliver
If you have faith in the cause and
the means and in God, the hot
Sun will be cool for you.
|
|
|
|
|
1) Make sure all drawing is done in OnPaint.
2) Try to invalidate only the area where the Tower bitmap is after switching Tower bitmaps.
3) Consider changing the way in which you draw your bitmaps. This may mean only drawing the part of a given bitmap, take a good look at how BitBlt can be used for that. If you are redrawing the whole World Map each 500 ms (whether you need to or not), that is going to slow things down. A few calculation to detemine what part of a large bitmap needs to be redrawn can save a lot of time.
Note: If you where to where to try to design simple paint program, you would soon see that redrawing the whole bitmap every time someone move the mouse (while drawing), will not work. Because each redraw would stop everything until the drawing code caught up.
This all means: draw only what you need to draw and no more.
Well got to go, for now!
Good Luck!
INTP
|
|
|
|
|
Hi,
Thanks for your valuable suggestion.
Actually I am not drawing World Map every time. It is drawn only once but I am drawing small towers on the MainMap in OnTimer() event. There might be atleast 300 to 400 small tower bitmaps which have to be loaded and drawn on the MainMap. I think you got confused. Let me explain you.
1) In OnPaint() I have drawn a MainMap on the Dialog Box.
2) In OnTimer() I am drawing 400 small bitmaps on the Dialog Box which appears like those small towers are on the MainMap.
I think now you got it.
Problem is I have to blit 400 bitmaps every time for 500 milliseconds to get blinking effect.
When my application is running and when ever I see my CPU usage it starts with 29% and when it was drawing 400 small bitmaps suddenly CPU usage goes to 54%.
I think CPU usage is going up because I am blitting 400 small tower bitmap at once.
I want to reduce the CPU usage.
"Make sure all drawing is done in OnPaint" I cannot do this because I have to call invalidate every time from OnTimer() this may increase CPU usage even more(This is what I am thinking but I have to test this and let you know with in few days).
I hope you understood my design. Please help me.
I think instead of blitting every time small bitmaps on the Dialog BOx. I think I will take some CStatic Controls.
and call SetBitmap(HBITMAP) to change the bitmap in those controls and Move these CStatic controls on different locations on Dialog Box. This may not also work because in OnPaint() I am Drawing MainMap this MainMap may overrite on these static controls and these static controls may not be visible.
Suggest me some thing good Idea. Plsssssssss
Thanks & Regards,
Deliver.
If you have faith in the cause and
the means and in God, the hot
Sun will be cool for you.
|
|
|
|
|
That is a lot of bitmaps!
You still need to do all the drawing in OnPaint and just invalidate in OnTimer. If you called UpdateWindow after calling InvalidateRect you would still have the same problem.
I thought of some different solutions on the way to work this mourning and it looks like one might work. This works on the assumption that the Towers are all one color or the other, and either they do not move (or rarely do).
1) Create 2 new member bitmaps (CBitmap m_b[2]), the same size as the Word Map.
2) Use BitBlt to copy the World Map to each of them.
3) Then draw all the Towers of one color onto one bitmap and the other color on the other bitmap.
4) Add a int member variable as index for bitmap array (range 0-1).
5) Then in OnTimer, just change the index then invalidate the rect containing the whole World Map.
If for some reason any of the Towers need to move or stop blinking, then you just need to update one or both of the bitmaps (at that time).
That should do the trick, unless I missed something else.
It is better to do one large blit than to do hundreds of small blits.
Good Luck!
INTP
|
|
|
|
|
I have a CList defined in my dialog apps main header file like this (not within the class definition):
static CList<SONGSTRUCT,SONGSTRUCT&> TrackList;
It works fine in the apps main dialog class, but when I try to access it from another dialog class within the same app then it shows an empty list, although it sees it.
I need access to this list from all dialogs within my app without copying it all over the place, how does one go about doing that?
tia,
Rick
|
|
|
|
|
Cpt Rick wrote:
I need access to this list from all dialogs within my app without copying it all over the place, how does one go about doing that?
One way would be to make it a member variable of the CWinApp -derived class. Then whenever it was needed, just use AfxGetApp()->TrackList .
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Well, I tried that by moving it here:
class CMyApp : public CWinApp
{
public:
CMyApp();
HICON m_Icon;
static CList<SONGSTRUCT,SONGSTRUCT&> TrackList;
And I get this error:
error C2039: 'TrackList' : is not a member of 'CWinApp'
???
|
|
|
|
|
Firstly, it probably doesn't want to be static.
Secondly, AfxGetApp() returns a CWinApp*. You will need to cast it appropriately, eg
((CMyApp*)AfxGetApp())->TrackList
should do the trick.
Steve S
Developer for hire
|
|
|
|
|
Thanx Steve, that did the trick.
What I don't understand is why it wouldn't work right as a static global???
|
|
|
|
|
? Is it defined globally?
"Naked we come and bruised we go."
- James Douglas Morrison
Best Wishes,
ez_way
|
|
|
|
|
Hello!
I'm currently writing some plugin framework. The plugins are implemented as simple DLLs. The main application has some class A. It passes a pointer to this class to the DLL. The DLL knows the class (it can include the header file of A) and can now perform operations with it.
Now, what happens if the class extends (a developer adds a function or variable for example) and the main application gets recompiled? Will the DLL still be able to access the class?
Of course it cannot know the new functions or variables. But will the old functions still be accessible or are they completely incompatible now?
Thanks in advance and best regards
|
|
|
|
|
I think If your class is not having any virtual functions inside or any other mechanism like COM does...then It will work fine...otherwise it won't
|
|
|
|