|
hav an idea, u can try it: surely the control panel is setting some entry in the registry to false or something like that, so all u need is try to know that entry.
If this ever exists, (hope it does) u can spy it using RegMon tool on the www.sysinternals.com
Hope this help
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
While not an answer to your question, have you looked at maybe using CreateProcess() to start your app in REALTIME mode? This will give you the highest possible priority, above nearly everything else, without having to disable other processes or drivers. You could write a little proxy application whose sole job is to launch your actual app by calling CreateProcess() with a creation flag of REALTIME_PRIORITY_CLASS.
Just a word of caution, of course... if you do it this way you will have priority above even disk I/O. Like the friendly manual states, if your process runs for more than a very brief interval, you can "cause disk caches not to flush or cause the mouse to be unresponsive."
If REALTIME is too much, there are also HIGH_PRIORITY_CLASS and ABOVE_NORMAL_PRIORITY_CLASS (Win2000) flags that are not quite as severe, but still preempt normal apps. Just take a gander at the CreateProcess() docs.
Ty
"The significant problems we face cannot be solved at the same level of thinking we were at when we created them." -Albert Einstein
|
|
|
|
|
Thanks for the thought. I have indeed been experimenting with this with some success. However, it's also a good thing to turn off sources of hardware interrupts that I would just as soon avoid. I deal with the disk I/O problem by using a gigabyte of RAM, locking pages in memory, and avoiding any file I/O until the acquisition is complete.
Since I only need this priority level for a small portion of my application's running time, I use SetPriorityClass() rather than CreateProcess() .
I am trying to capture 5000 frames per second from a high-speed camera, so I am trying to avoid even an occasional millisecond of latency.
I would really like to work with an RTOS, such as QNX, but the frame grabber board I must use only has drivers for Windows.
|
|
|
|
|
I did a quick google search and came up with a few things that might help. Someone mentioned that there's a sample in the Windows DDK, under NTDDK\src\general\setup\Enable. Whether that has disable code or not, I'm not sure
More interestingly, there's an external program named DevCon that might do the trick, and apparently Microsoft gives out the source code in their latest XP DDK:
DevCon.exe KB Q311272[^]
Ty
"The significant problems we face cannot be solved at the same level of thinking we were at when we created them." -Albert Einstein
|
|
|
|
|
Thanks a million! Those pointers help me with exactly what I need. For the moment, calling DevCon from my application should do just what I need. Sometime later, I can see about incorporating the DDK code into my application's core.
Thanks so much for pointing me an answer.
|
|
|
|
|
Glad to help
Ty
"The significant problems we face cannot be solved at the same level of thinking we were at when we created them." -Albert Einstein
|
|
|
|
|
Just a wild guess, but have you looked at the CloseClusterNetInterface() function?
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
What is the correct way to update the FormView(EditBoxes)on the fly from the Document after the OnInitialUpdate? I am currently using a pointer to the View object, this works but seems to me that it is by-passing the rules of encapulation.
Steve Daly
|
|
|
|
|
See UpdateAllViews .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi there !!
I am currently working on my term project in VC++ using MFC. I want to implement MSN Messenger type System tray alert messages (which appears when a user signs in or a new email is recieved ) in MFC. If anyone could tell me how to implement it , which classes to use or could tell me any references or any example, I would be obliged.
Petrol.
|
|
|
|
|
http://www.codeguru.com/dialog/TaskbarNotifier.html
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
My question has two parts.
In order to split my project into smaller parts I had to create an mfc extension dll. According to msdn, extension dlls can only use mfc as shared dll although VC 6.0 allows me to link with static mfc library too.(?? I am confused here) Also using extension dll forces me to link my client.exe with shared mfc dll too. Can I avoid all of these and link all extension dlls,client.exe with static library. is there a trick for this ?
Second question is if I use shared mfc dlls do I have to distribute them with my installation or do they come with windows setup by default. The dlls are mfc42.dll and msvcrt.dll
I hope my questions are understandable because I am confused because of this static , dynamic mfc stuff.
Thank you
Orcun Colak
|
|
|
|
|
MFC Extension DLL is an add-on for MFC42.dll. It needs it by design.
orcun colak wrote:
do I have to distribute them with my installation
You need to redistribute them.
Pavel
Sonork 100.15206
|
|
|
|
|
I have been looking through the threads of in the board.Can't seems to be able to understand how to do it. I need to get rid of the ugly message in the Title bar with "Untitled - myprogram" and update it with my own message. Anyone that can help me on that?
Please try to include some lines of codes. I am really very new in VC++ 6.0.
Thanks!
|
|
|
|
|
Try looking up SetWindowText in ur MSDN, sorry about lines of code, but its nearly:
in the MainFrame Class or dialog class u call:
SetWindowText ( _T("Ur title") ) ;
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Thanks for the information. I was trying a few ways to
do it and it's working!! Just curious, is there anyway I could replace the whole line of the title bar. I mean I could replace the Untitled part, but not able to get rid of
the program name at the end of the string.
|
|
|
|
|
i try to recognize by using space, but unsuccess. it might be the coding error. can someone pls show me the coding.thanks. ur reponse will be appreciated for me.
|
|
|
|
|
you will also have to use punctuation marks such as '.',',',';' etc. Hyphens are also wierd as they can indicate a joining of words or that a word has been split to allow it to wrap at the end of a line (not end of sentence), this normally happens after the 3rd charcter.
eg con-
tinutation
Stupidity dies.
The end of future offspring.
Evolution wins.
- A Darwin Awards Haiku
|
|
|
|
|
Splitting of words happens between two syllables. e.g.: Split-ting, not Spl-itting
|
|
|
|
|
true - but I remember a 3 letter rule as well that you do not break the word if the first part is less than 3 letters but just start it on the next line.
Stupidity dies.
The end of future offspring.
Evolution wins.
- A Darwin Awards Haiku
|
|
|
|
|
can i have a example full source code?
|
|
|
|
|
Somebody is not doing their homework. How do you expect to learn how to program if you dont want to do the work? I sugest switching courses. Youll get no help here.
Heres some assistance though. Define "what" a word is. Is is a series of alpha characters followed by a space or possibly a form of punctuation? . , ; ' : -
or is your programs definition of a word slighly simpler?
can a word have numerical characters in it? is l33t a word?
Ryan Baillargeon
Software Specialist
Fuel Cell Technologies Inc.
|
|
|
|
|
I think you should be misunderstanding, or else it is my fault. i suppose to post my coding and lets you all expertise and checking the error for me. However, the system now is workable for space. one more question is if i would like to get some particular word, lets say 3rd word from the sentence. then what should i add inside?
the following is the coding:
#include <iostream>
using std::cout;
using std::endl;
using std::cin;
#include <cstring>
int main()
{
char string[256];
char *tokenPtr;
cout << "Enter sentence\n";
cin.getline(string,sizeof(string),'\n');
cout << "The string to be tokenized is:\n" << string
<< "\n\nThe tokens are:\n";
tokenPtr = strtok( string, " " );
while ( tokenPtr != NULL ) {
cout << tokenPtr << '\n';
tokenPtr = strtok( NULL, " " );
}
return 0;
}
|
|
|
|
|
I was positioning my richedit so that it hugged the bottom edge of my UI at all times using (in OnSize):
m_editright1.MoveWindow(cx - 200, 390 - VScrollDistance, 200, <code>cy-350+ VScrollDistance</code>);
This works well, but the edge hugged is the visible bottom edge, not the region hidden by the scrollbars of my MFC MDI app. (Strange fact: If I scroll down completely and resize it does elongate (beyond?) to the real bottom edge ). SO in order to make sure I definitely get the bottom hugging behavior (with or without scrolling and resizing) I made the box superlong:
cy+ VScrollDistance .
The problem is that the vertical scrollbars never develop for the control even if I shrink my UI to be less tall and the text gets obscured. If it truly hugged the bottom at all times, I feel the scrollbars would develop. Any ideas on how I can get it to align itself along the TRUE bottom edge of the UI and not just the visible region right from the start.( I do this positioning in the OnSize event which seems to run after OnInitialUpdate, so any positioning I do in the latter will be overridden)?
Thanks,
ns
|
|
|
|
|
Greetings
I have been able to automate Word using my application. I have been able to write three lines of text into it.
Now how should I create tables and format text in it.
Now how should I add tables for formatting.
Ritesh
Below is the code which i am using
=============================================================================
#include <ole2.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
// ******************* Declare Some Variables ********************
// Variables that will be used and re-used in our calls
DISPPARAMS dpNoArgs = {NULL, NULL, 0, 0};
VARIANT vResult;
OLECHAR FAR* szFunction;
BSTR bstrTemp;
// IDispatch pointers for Word's objects
IDispatch* pDispDocs; //Documents collection
IDispatch* pDispSel; //Selection object
IDispatch* pDispActiveDoc; //ActiveDocument object
// DISPID's
DISPID dispid_Docs; //Documents property of Application object
DISPID dispid_DocsAdd; //Add method of Documents collection
//object
DISPID dispid_Sel; //Selection property of Applicaiton object
DISPID dispid_TypeText; //TypeText method of Selection object
DISPID dispid_TypePara; //TypeParagraph method of Selection object
DISPID dispid_ActiveDoc; //ActiveDocument property of Application
//obj
DISPID dispid_SaveAs; //SaveAs method of the Document object
DISPID dispid_Quit; //Quit method of the Application object
// ******************** Start Automation ***********************
//Initialize the COM libraries
::CoInitialize(NULL);
// Create an instance of the Word application and obtain the pointer
// to the application's IDispatch interface.
CLSID clsid;
CLSIDFromProgID(L"Word.Application", &clsid);
IUnknown* pUnk;
HRESULT hr = ::CoCreateInstance( clsid, NULL, CLSCTX_SERVER,
IID_IUnknown, (void**) &pUnk);
IDispatch* pDispApp;
hr = pUnk->QueryInterface(IID_IDispatch, (void**)&pDispApp);
// Get IDispatch* for the Documents collection object
szFunction = OLESTR("Documents");
hr = pDispApp->GetIDsOfNames (IID_NULL, &szFunction, 1,
LOCALE_USER_DEFAULT, &dispid_Docs);
hr = pDispApp->Invoke (dispid_Docs, IID_NULL, LOCALE_USER_DEFAULT,
DISPATCH_PROPERTYGET, &dpNoArgs, &vResult,
NULL, NULL);
pDispDocs = vResult.pdispVal;
// Invoke the Add method on the Documents collection object
// to create a new document in Word
// Note that the Add method can take up to 3 arguments, all of which
// are optional. We are not passing it any so we are using an empty
// DISPPARAMS structure
szFunction = OLESTR("Add");
hr = pDispDocs->GetIDsOfNames(IID_NULL, &szFunction, 1,
LOCALE_USER_DEFAULT, &dispid_DocsAdd);
hr = pDispDocs->Invoke(dispid_DocsAdd, IID_NULL, LOCALE_USER_DEFAULT,
DISPATCH_METHOD, &dpNoArgs, &vResult, NULL,
NULL);
// Get IDispatch* for the Selection object
szFunction = OLESTR("Selection");
hr = pDispApp->GetIDsOfNames (IID_NULL, &szFunction, 1,
LOCALE_USER_DEFAULT, &dispid_Sel);
hr = pDispApp->Invoke (dispid_Sel, IID_NULL, LOCALE_USER_DEFAULT,
DISPATCH_PROPERTYGET, &dpNoArgs, &vResult,
NULL, NULL);
pDispSel = vResult.pdispVal;
// Get the DISPIDs of the TypeText and TypeParagraph methods of the
// Selection object. We'll use these DISPIDs multiple times.
szFunction = OLESTR("TypeText");
hr = pDispSel->GetIDsOfNames(IID_NULL, &szFunction, 1,
LOCALE_USER_DEFAULT, &dispid_TypeText);
szFunction = OLESTR("TypeParagraph");
hr = pDispSel->GetIDsOfNames(IID_NULL, &szFunction, 1,
LOCALE_USER_DEFAULT, &dispid_TypePara);
// The TypeText method has and requires only one argument, a string,
// so set up the DISPPARAMS accordingly
VARIANT vArgsTypeText[1];
DISPPARAMS dpTypeText;
bstrTemp = ::SysAllocString(OLESTR("Metallica"));
vArgsTypeText [0].vt = VT_BSTR;
vArgsTypeText [0].bstrVal = bstrTemp;
dpTypeText.cArgs = 1;
dpTypeText.cNamedArgs = 0;
dpTypeText.rgvarg = vArgsTypeText;
//Invoke the first TypeText and TypeParagraph pair
hr = pDispSel->Invoke (dispid_TypeText, IID_NULL,
LOCALE_USER_DEFAULT, DISPATCH_METHOD,
&dpTypeText, NULL, NULL, NULL);
hr = pDispSel->Invoke (dispid_TypePara, IID_NULL,
LOCALE_USER_DEFAULT, DISPATCH_METHOD,
&dpNoArgs, NULL, NULL, NULL);
::SysFreeString(bstrTemp);
//Invoke the second TypeText and TypeParagraph pair
bstrTemp = ::SysAllocString(OLESTR("Pantera"));
hr = pDispSel->Invoke (dispid_TypeText, IID_NULL,
LOCALE_USER_DEFAULT, DISPATCH_METHOD,
&dpTypeText, NULL, NULL, NULL);
hr = pDispSel->Invoke (dispid_TypePara, IID_NULL,
LOCALE_USER_DEFAULT, DISPATCH_METHOD,
&dpNoArgs, NULL, NULL, NULL);
::SysFreeString(bstrTemp);
//Invoke the third TypeText and TypeParagraph pair
bstrTemp = ::SysAllocString(OLESTR("Godsmack"));
hr = pDispSel->Invoke (dispid_TypeText, IID_NULL,
LOCALE_USER_DEFAULT, DISPATCH_METHOD,
&dpTypeText, NULL, NULL, NULL);
hr = pDispSel->Invoke (dispid_TypePara, IID_NULL,
LOCALE_USER_DEFAULT, DISPATCH_METHOD,
&dpNoArgs, NULL, NULL, NULL);
::SysFreeString(bstrTemp);
// Get IDispatch* for the ActiveDocument object
szFunction = OLESTR("ActiveDocument");
hr = pDispApp->GetIDsOfNames (IID_NULL, &szFunction, 1,
LOCALE_USER_DEFAULT,
&dispid_ActiveDoc);
hr = pDispApp->Invoke (dispid_ActiveDoc, IID_NULL,
LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET,
&dpNoArgs, &vResult, NULL, NULL);
pDispActiveDoc = vResult.pdispVal;
//Set up the DISPPARAMS for the SaveAs method (11 arguments)
VARIANT vArgsSaveAs[11];
DISPPARAMS dpSaveAs;
dpSaveAs.cArgs = 11;
dpSaveAs.cNamedArgs = 0;
dpSaveAs.rgvarg = vArgsSaveAs;
BSTR bstrEmptyString;
bstrEmptyString = ::SysAllocString(OLESTR(""));
VARIANT vFalse;
vFalse.vt = VT_BOOL;
vFalse.boolVal = FALSE;
bstrTemp = ::SysAllocString(OLESTR("c:\\doc1.doc"));
vArgsSaveAs[10].vt = VT_BSTR;
vArgsSaveAs[10].bstrVal = bstrTemp; //Filename
vArgsSaveAs[9].vt = VT_I4;
vArgsSaveAs[9].lVal = 0; //FileFormat
vArgsSaveAs[8] = vFalse; //LockComments
vArgsSaveAs[7].vt = VT_BSTR;
vArgsSaveAs[7].bstrVal = bstrEmptyString; //Password
vArgsSaveAs[6].vt = VT_BOOL;
vArgsSaveAs[6].boolVal = TRUE; //AddToRecentFiles
vArgsSaveAs[5].vt = VT_BSTR;
vArgsSaveAs[5].bstrVal = bstrEmptyString; //WritePassword
vArgsSaveAs[4] = vFalse; //ReadOnlyRecommended
vArgsSaveAs[3] = vFalse; //EmbedTrueTypeFonts
vArgsSaveAs[2] = vFalse; //SaveNativePictureFormat
vArgsSaveAs[1] = vFalse; //SaveFormsData
vArgsSaveAs[0] = vFalse; //SaveAsOCELetter
//Invoke the SaveAs method
szFunction = OLESTR("SaveAs");
hr = pDispActiveDoc->GetIDsOfNames(IID_NULL, &szFunction, 1,
LOCALE_USER_DEFAULT, &dispid_SaveAs);
hr = pDispActiveDoc->Invoke(dispid_SaveAs, IID_NULL,
LOCALE_USER_DEFAULT, DISPATCH_METHOD,
&dpSaveAs, NULL, NULL, NULL);
::SysFreeString(bstrEmptyString);
//Invoke the Quit method
szFunction = OLESTR("Quit");
hr = pDispApp->GetIDsOfNames(IID_NULL, &szFunction, 1,
LOCALE_USER_DEFAULT, &dispid_Quit);
hr = pDispApp->Invoke (dispid_Quit, IID_NULL, LOCALE_USER_DEFAULT,
DISPATCH_METHOD, &dpNoArgs, NULL, NULL, NULL);
//Clean-up
::SysFreeString(bstrTemp);
pDispActiveDoc->Release();
pDispSel->Release();
pDispDocs->Release();
pDispApp->Release();
pUnk->Release();
::CoUninitialize();
return 0;
}
|
|
|
|
|