|
For other controls, the correct way would be with OnCtlColor() . However, I do not see a CTLCOLOR_xxx value for rich-edit controls.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
does CRichEditCtrl::SetBackgroundColor work ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
it is exactly what i want.
thx
includeh10
|
|
|
|
|
there are 3 std* handles: stdin,stdout,stderr;
we can use GetStdHandle() with STD_INPUT_HANDLE,STD_OUTPUT_HANDLE,STD_ERROR_HANDLE as param to get 3 handles also.
what are differences between the 2 group handles?
i.e. between stdin and GetStdHandle(STD_INPUT_HANDLE)?
in my dos program, GetStdHandle(*)s work well but stdin, stdout and stderr do not work. do u know why?
thx
includeh10
|
|
|
|
|
includeh10 wrote:
in my dos program, GetStdHandle(*)s work well but stdin, stdout and stderr do not work. do u know why?
Which indicates that you are possibly using them incorrectly. Please post the code snippet that is not working.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi,
this dos app is an interface between other 2 apps, it is very short, here is all code:
1.if relacing GetStdHandle() with std*, the program is not working.
2. it works on win98, but doesn't work on XP, what is wrong?
//=============================================
int WINAPI Thread_Read(void*pv);
int WINAPI Thread_OutWrite(void*pv);
int WINAPI Thread_ErrWrite(void*pv);
struct BaseHandles
{
HANDLE hInWrite,hOutRead,hErrRead;
};
BOOL CreateProcessMe(char*pszCmdLine,PROCESS_INFORMATION&pi,STARTUPINFO&si)
{
void*psd=0;
LPSECURITY_ATTRIBUTES psa=0;
DWORD bNT=(GetVersion()>=0x80000000)?0:1;
if(bNT)
{
psd=::GlobalAlloc(GPTR,SECURITY_DESCRIPTOR_MIN_LENGTH);
::InitializeSecurityDescriptor(psd,SECURITY_DESCRIPTOR_REVISION);
::SetSecurityDescriptorDacl(psd,-1,0,0);
psa=(LPSECURITY_ATTRIBUTES)::GlobalAlloc(GPTR,sizeof(SECURITY_ATTRIBUTES));
psa->nLength=sizeof(SECURITY_ATTRIBUTES);
psa->lpSecurityDescriptor=psd;
psa->bInheritHandle=1;
}
const BOOL bOK=CreateProcess(0,pszCmdLine,psa,0,1,0,0,0,&si,&pi);
if(psa) ::GlobalFree(psa);
if(psd) ::GlobalFree(psd);
::CloseHandle(pi.hThread);
return bOK;
}
BOOL CreateDupPipe(HANDLE&hRead,HANDLE&hWrite,const BOOL bWrite)
{
SECURITY_ATTRIBUTES saPipe;
saPipe.nLength=sizeof( SECURITY_ATTRIBUTES );
saPipe.lpSecurityDescriptor=0;
saPipe.bInheritHandle=1;
HANDLE hTemp;
BOOL b;
HANDLE hProcess=::GetCurrentProcess();
if(bWrite)
{
b=::CreatePipe(&hRead,&hTemp,&saPipe,0);
::DuplicateHandle(hProcess,hTemp,hProcess,&hWrite,0,0,DUPLICATE_SAME_ACCESS);
}
else
{
b=::CreatePipe(&hTemp,&hWrite,&saPipe,0);
::DuplicateHandle(hProcess,hTemp,hProcess,&hRead,0,0,DUPLICATE_SAME_ACCESS);
}
::CloseHandle(hTemp);
return b;
}
int main(int argc,char* argv[])
{
PROCESS_INFORMATION pi;
STARTUPINFO si;
char szCmd[256];
int i,iLen=0;
if(argc<2) return 1;
szCmd[0]=0;
for(i=1;i<argc;i++)
="" {
="" strcat(szcmd,argv[i]);
="" strcat(szcmd,"="" ");
="" }
="" ------------------------------------------
="" memset(&pi,0,sizeof(pi));
="" memset(&si,0,sizeof(si));
="" si.cb="sizeof(si);
" si.dwflags="STARTF_USESTDHANDLES;
" basehandles="" bh;
="" dword="" dwid;
="" handle="" hthread;
="" createduppipe(si.hstdinput,bh.hinwrite,1);
="" hthread="::CreateThread((LPSECURITY_ATTRIBUTES)0,0,
" (lpthread_start_routine)thread_read,
="" &bh,0,&dwid);
="" createduppipe(bh.houtread,si.hstdoutput,0);
="" (lpthread_start_routine)thread_outwrite,
="" &bh,0,&dwid);
="" createduppipe(bh.herrread,si.hstderror,0);
="" (lpthread_start_routine)thread_errwrite,
="" const="" bool="" bok="CreateProcessMe(szCmd,pi,si);
" if(bok="=0)" return="" 1;
="" waitforsingleobject(pi.hprocess,infinite);
="" closehandle(pi.hprocess);
="" closehandle(pi.hthread);
="" 0;
}=""
int="" winapi="" thread_read(void*pv)
{
="" basehandles*pbh="(BaseHandles*)pv;
" hread="GetStdHandle(STD_INPUT_HANDLE);
" b;
="" dw;
="" char="" sz[1024];
="" while(1)
="" b="::ReadFile(hRead,sz,1023,&dw,0);
" if(b="=0)" break;
="" if(dw<="0)" sz[dw]="0;
" ::writefile(pbh-="">hInWrite,sz,dw,&dw,0);
}
return 1;
}
int WINAPI Thread_OutWrite(void*pv)
{
const BaseHandles*pBh=(BaseHandles*)pv;
const HANDLE hOutWrite=GetStdHandle(STD_OUTPUT_HANDLE);
BOOL b;
DWORD dw;
char sz[1024];
while(1)
{
b=::ReadFile(pBh->hOutRead,sz,1023,&dw,0);
if(b==0) break;
if(dw<=0) break;
sz[dw]=0;
::WriteFile(hOutWrite,sz,dw,&dw,0);
}
return 1;
}
int WINAPI Thread_ErrWrite(void*pv)
{
const BaseHandles*pBh=(BaseHandles*)pv;
const HANDLE hErrWrite=GetStdHandle(STD_ERROR_HANDLE);
BOOL b;
DWORD dw;
char sz[1024];
while(1)
{
b=::ReadFile(pBh->hErrRead,sz,1023,&dw,0);
if(b==0) break;
if(dw<=0) break;
sz[dw]=0;
::WriteFile(hErrWrite,sz,dw,&dw,0);
}
return 1;
}
includeh10
|
|
|
|
|
This is one of those situations where stdin /stdout and a HANDLE type cannot be interchanged. Remember that stdin /stdout are derived from the _iobuf structure, and the handles returned from GetStdHandle() are true handles (void* types).
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi there
I am working on a application that is supposed to create a dial up connection in order to connect two computers using the serial port (direct connection using the serial port). I can create the entry no problem but the problem i am running into is that it will not attach the serial port to it (by the way i am using RAS API)
I am setting the device type to serial but the com port is not attached to the connection created.
If i try to create the same connection using the wizard that is provided with Win XP than it gives me the option to select the serial port as a means of communication. Once i create this connection and i run my program i get the desired output so it looks like the COM ports need to be configured for RAS. Is there any way to do that programatically or run a script?
Any help will be greately appreciated!!!
<br />
<br />
<br />
LPRASENTRY lpRasEntry = NULL;<br />
DWORD cb = sizeof(RASENTRY);<br />
DWORD dwRet;<br />
DWORD dwBufferSize = 0;<br />
<br />
<br />
<br />
RasGetEntryProperties(NULL, "", NULL, &dwBufferSize, NULL, NULL);<br />
if(dwBufferSize == 0)<br />
return FALSE;<br />
<br />
lpRasEntry = (LPRASENTRY)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwBufferSize);<br />
if (lpRasEntry == NULL)<br />
return FALSE;<br />
<br />
lpRasEntry->dwSize = dwBufferSize;<br />
lpRasEntry->dwfOptions = RasEntry.dwfOptions; <br />
lpRasEntry->dwfNetProtocols = RASNP_Ip;<br />
lpRasEntry->dwFramingProtocol = RASFP_Ppp;<br />
lpRasEntry->dwType = RASET_Direct;<br />
strcpy(lpRasEntry->szDeviceType, RASDT_Serial); <br />
<br />
<br />
strcpy(lpRasEntry->szDeviceName, ports[0].name);<br />
dwRet = RasSetEntryProperties(NULL, strEntryName,lpRasEntry, dwBufferSize, NULL, 0);<br />
<br />
HeapFree(GetProcessHeap(), 0, (LPVOID)lpRasEntry);<br />
|
|
|
|
|
Hi All,
I am using (Visual C++ 1.52 IDE )for my MFC Application Project. I am working on an existing code base where the no of lines is around 100,000, spread across different header and cpp files. when i was trying to add a new function declaration for an existing class in a header file and function implementation in the .cpp file i am getting an error as given below
: fatal error C1001: internal compiler error
(compiler file 'msc3.cpp', line 429)
CL returned error code 2.
in another .cpp file.
This problems also occurs when i try to add parameters to the existing function in an existing class
heap size is 1024 declared in .def file and i have set my stack size as 8500
Pls let me know if any one has solution to this problem
Thanks in advance
Regards
Senthil.
|
|
|
|
|
See if MSDN article Q149786 is of any help.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi
I am using a rih edit control in my SDK app. So when i was executing the app i got the "Cannot find window class" error when i tried to call CreateDialog(..).
So i did the following
INITCOMMONCONTROLSEX init;
memset(&init, 0, sizeof(init));
init.dwSize = sizeof(INITCOMMONCONTROLSEX);
init.dwICC = ICC_STANDARD_CLASSES;
InitCommonControlsEx(&init);
Now i get an error that 'ICC_STANDARD_CLASSES' : undeclared identifier even when commctrl.h and comctl32.lib are properly used.
|
|
|
|
|
Per MSDN, ICC_STANDARD_CLASSES is not a valid option.
Prior to creating the control, I think you might need to call LoadLibrary("riched20.dll") .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
The rich edit control is initialized differently than other controls. You need to load either riched32.dll or riched20.dll in your app's init code, depending on which rich edit version you need.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
Hi all,
Can we declare constructor in private section?
Regards
Rajesh
rajesh
|
|
|
|
|
Yes you can. But if you want to create an object of that class, you will need a public static member function in the class to create the object for you.
« Superman »
|
|
|
|
|
If I want to create an object of that class whose constructor is private and dont want a static member function to create an object then?
http://www.priyank.in/
|
|
|
|
|
you can create a factory class and declare it as a friend of your class. what exactly are you trying to achieve?
|
|
|
|
|
Trying to achieve nothing. Just finding out the answers, these questions are asked generally everywhere in interviews. Can you do that without a friend class also?
http://www.priyank.in/
|
|
|
|
|
the purpose of private constructors is to make it impossible for clients to call them as they wish. 2 ways to do it should be quite enough, it wouldn't make sense to make them private and provide ten other ways to call them.
|
|
|
|
|
yes you can (why couldn't you ?), but the only reason you might want to do this is to let it do some common initializations ; then you could call it from another constructor of the same class...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hello..
I am using MCI for recording sound.. I am using the sample code given in MSDN for recording.. This allows me to record sound only for specified amount of time.. I want to generalise it so that, recording stops when i click on the stop button..
At present what i am doing is as follows:
void CCNPhoneAdapterDlg::OnRecord()
{
RecordWaveFile(10000);
}
DWORD CCNPhoneAdapterDlg::RecordWaveFile(DWORD dwMilliSeconds)
{
// Begin recording and record for the specified number of
// milliseconds. Wait for recording to complete before continuing.
// Assume the default time format for the waveform-audio device
// (milliseconds).
mciRecordParms.dwTo = dwMilliSeconds;
if (dwReturn = mciSendCommand(wDeviceID, MCI_RECORD,
MCI_TO | MCI_WAIT, (DWORD)(LPVOID) &mciRecordParms))
{
mciSendCommand(wDeviceID, MCI_CLOSE, 0, NULL);
return (dwReturn);
}
// Save the recording to a file named TEMPFILE.WAV. Wait for
// the operation to complete before continuing.
mciSaveParms.lpfilename = "tempfile.wav";
if (dwReturn = mciSendCommand(wDeviceID, MCI_SAVE,
MCI_SAVE_FILE | MCI_WAIT, (DWORD)(LPVOID) &mciSaveParms))
{
mciSendCommand(wDeviceID, MCI_CLOSE, 0, NULL);
return (dwReturn);
}
return (0L);
}
................
Also i want to allow the user to specify the location and file name to store the recorded sound.
Can anyone help me?
Regards
Pallavi
|
|
|
|
|
Friends,
I've made an application which is automating MS-Word. I run MS-WORD from my application and my application receives events happening in that instance of MS-Word.
I want to detect keyboard events in that instance of MS word inside my application. Actually i want user to type some string in Word and press some key like Ctrl-A. As such i want MS-Word no notify my application. Is it possible with automation ?? If not then what is the solution.
Imtiaz
|
|
|
|
|
like
image link:
http://explorer.10169.net/myquestion.jpg
please help me!
How are you,every one
|
|
|
|
|
if the button is not on border (NC area), just move it to there by MoveWindow(). otherwise, u need to draw NC area urself to prevent the button from being painted (covered) by default NC drawing.
includeh10
|
|
|
|
|
I am using Visual C++ 6.0 MFC.
My database in SQL SERVER 2000
How can i Execute a data manipulation query(Delete, insert,update) with OLE DB data access ?
We use OLE DB PROVIDER or CONSUMER ?
And How to do it
I am a beginer
|
|
|
|
|