|
Is there any way to mimic the behavior of PrintInsideRect() when printing from a CScrollView?
Printing... what a pain.
|
|
|
|
|
Yes, do the printing yourself
Catch OnPrint in your derive CScrollView.
- God bless the World
|
|
|
|
|
Any guidance on how to tell programatically whether Visual C++ is running? The simplest solution would appear to be if there is a known mutex that I could refer to, but I have had no luck finding any such information in MSDN or on the web.
Failing that, other suggestions also welcome. It's with a view to writing installer(s) using Martijn Laan's "My Inno Setup Extensions", so I can write an extension DLL in C++ if necessary.
Cheers,
Gavin Greig
|
|
|
|
|
You need to Use PSAPI Functions.
Start with ProcessEnum Function...
I wrote a class that Do that you need...
If you want for a I can share the class with you....
Best Regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
Also you can See what Applications Are running enumming the HWND...
Also I Wrote a Class that Do that....
The Principal difference is that for PSAPI functions you need the psapi.dll that is only in NT and W2K, Don't work under win 95/98. I don't Know what happens with XP..
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
There are two simple ways:
1. Enumerating processes. You can use the following classes to enumarate processes on both NT/2000 and Win9x. http://www.codeproject.com/threads/enumprocess.asp
2. You can use FindWindow API to find Visual C++ window. You can also give the class name as a parameter to be sure that the window found is Visual C++ Window.
Hope this helps.
Kind regards
Mustafa Demirhan
http://www.macroangel.com
Sonork ID 100.9935:zoltrix
|
|
|
|
|
Thanks guys, I'll look into these.
Cheers,
Gavin Greig
|
|
|
|
|
Does anyone know where i can find a good example that shows how to send a file over the internet from one app to the other??
Kuniva
--------------------------------------------
God gave man a penis and a brain but not enough blood to make both of 'em work at the same time.
|
|
|
|
|
Suppose I have a process's handle, how can I figure it's CPU usage?
(Same about it's memory usage)
10x, be blessed.
--BlackSmith--
"With the help of all mighty", 2001, Me.
|
|
|
|
|
For NT 4.0/2000/XP sistems, seems like GetProcessTimes was written thinking of you
As for memory usage, the function to go is GetProcessMemoryInfo (implemented as part of the PSAPI performance Monitoring SDK).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Sorry for the ignorence, but suppose I called GetProcessTimes() and converted the FILETIME arg' to SYSTEMTIME (using FileTimeToSystemTime(),
how do I compute (and which parameter is the significant) the CPU usage of a process per second?
truthfully yours, Me.
--BlackSmith--
"With the help of all mighty", 2001, Me.
|
|
|
|
|
SYSTEMTIME is not a good choice to calculate relative times.
To compute CPU usage per second, just call GetProcessTimes every second and compute the difference of the paramaters lpKernelTime (time spent inside system routines) and lpUserTime (time spent inside user code). To subtract two FILETIME s, copy them to ULARGE_INTEGER s and subtract these (more info about FILETIME arithmetic on the online documentation about FILETIME ).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
There are two simple ways:
1. Enumerating processes. You can use the following classes to enumarate processes on both NT/2000 and Win9x. http://www.codeproject.com/threads/enumprocess.asp
2. You can use FindWindow API to find Visual C++ window. You can also give the class name as a parameter to be sure that the window found is Visual C++ Window.
Hope this helps.
Kind regards
Mustafa Demirhan
http://www.macroangel.com
Sonork ID 100.9935:zoltrix
|
|
|
|
|
|
I am working on an MFC MDI application. I'd like to have the document title (in the app's title bar) display an asterisk at the end when the document has been changed. When the document is saved, the asterisk disappears. MS Visual Studio's text editor has this capability.
Any suggestions on how to add this capability?
Marc
|
|
|
|
|
With AfxGetMainWnd you can get The main window Handle then you can use GetWindowText for read the Title and add a Asterisk when the docuement is changed using SetWindowText for write the new title. But Warning you can fill the Title with several asterisks, you need a control like a variable for this...
Regards...
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
CDocument provides some methods to maintain the "changed and unsaved" state, namely IsModified and SetModifiedFlag . I guess the best solution is to override SetModifiedFlag (assuming your app is using this method consistently) and change there the document's title accordingly using SetTitle .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Uh, i've tried a few dozen times to write a function that sees if a certain item of a list is also in another list but it just wouldn't work. And there's also a second difficulty, but i'll explain by giving the information needed:
First of all, its not really a list, but its several strings i can get after eachother. I have to parse a line of text wich uses '#' as a seperator like this:
cookoo#woowoo#blabla#weewee
this is the string(mystring) and i parse it with AfxExtractSubString(...) like this:
int index=0;
while(AfxExtractSubString(Item, LPCTSTR(mystring), index++, '#')
{
if(Item!="")
// Item is a good string so...
}
}
This is the same way for the two lists/strings only that the second string/list contains less or as much substrings as the first string/list and the strings the second string/list contains are always in the first one. BUT! it is possible that certain string(s) in the second one have '[' in front of it and ']' behind like this:
weewee#[woowoo]#gaga#blabla
i need to see this and make a difference between strings that have [] and strings that dont.
So the main goal is to see if any items from the first string/list are in the second one and if they have [] or not.
Can anyone help me with this as my brain seems to lack stamina for this.
Kuniva
--------------------------------------------
God gave man a penis and a brain but not enough blood to make both of 'em work at the same time.
|
|
|
|
|
Try something like this:
int index=0;
int index2;
CString mystring;
CString csSecondString;
while(AfxExtractSubString(Item, LPCTSTR(mystring), index++, '#')
{
if(Item!="")
{
int n = csSecondString.Find(Item);
if (n > -1)
{
if (n>0)
{
if (csSecondString[n-1] == "[" &&
csSecondString[n+Item.GetLength()] == "]")
{
}
}
}
}
}
Hope this helps,
Bill
|
|
|
|
|
I was browsing the internet when i came across a free utility that enables you to make your pc accessible using a static name, such as www.123-321.com, and wondered if anyone knew how to make that.
==================================================
When Your Mind Wonders...Where Does It Go???
|
|
|
|
|
The Eclypse wrote:
I was browsing the internet when i came across a free utility that enables you to make your pc accessible using a static name, such as www.123-321.com
Using any user-selectable domain name? Now that would be impressive...
Peace!
-=- James.
|
|
|
|
|
maybe they have a pre-registered list of say around 500 domains
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Nish [BusterBoy] wrote:
maybe they have a pre-registered list of say around 500 domains
That is why I asked:
> > Using any user-selectable domain name?
Besides, 500 domain names would go quick...!
Peace!
-=- James.
|
|
|
|
|
Anyone out there that has used Outlook can understand this: When you add an address to the "To..." edit control (when writing a new email message), once the address is "recognized", it becomes underlined, but also becomes an object. Meaning, it is only selectable as a whole item, you are no longer able to select part of the recognized address.
I have been unable to accurately duplicate this functionality. After staring at Spy++ for a while, I believe that the address text is eventually taken from the control (WM_GETTEXT), the OLE interface and Event Mask are accessed (EM_GETOLEINTERFACE, EM_GETEVENTMASK, EM_SETEVENTMASK), the Text Mode is accessed (EM_SETTEXTMODE, EM_GETTEXTMODE), the address is resolved/recognized, removed from the control (EM_SETSEL and WM_SETTEXT), and I believe address gets converted to some kind of visible COM object, because I never see a message that directly replaces the address text. But I am at a loss as to how to get started writing such an object.
Any thoughts (based in reality)? Or does anyone know how that REALLY works, that can tell me that I am WAY off base, and can tell/show me how it is done?
Peace!
-=- James.
|
|
|
|
|
I believe the thing you see in the address edit control is just a piece of text. The event handling is what keeps you from editing or selecting part of it.
I do not, however, have any special inside knowledge of how this is implemented.
Hope this helps,
Bill
|
|
|
|