|
i get the handle of a textbox in an opened window using the function
EnumChildWindows(,,)..
after i obtained the handle of this textbox i want to set a specific
string in this textbox.
"HINT" : the function SetWindowText(,) isn't a valid to this task(why?)
more--->
the opened window has a textbox ,a button ,a label;
and when i used the spy++ program of Microsoft tools to get the caption
to each of them after using SetWindowtext(,),i observed that:
the caption of the label is same as the value appears on it<the
caption="" and="" value="" appears="" are="" equal="" to="" each="" other="" the="" string
posted="" by="" setwindowtext()=""> ,BUT
the caption of the textbox isn't the same as the value appears on it
<the value="" is="" nothing="" but="" the="" caption="" equal="" to="" string="" posted="" by=""
setwindowtext()="" function="">then i want an API function to set the value of the textbox not the
caption..
thank you very much for any help..
Sender :Amr abdel mohsen
Email: app_prog@yahoo.com
amr
|
|
|
|
|
You can also check for WM_SETTEXT Window Message
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
i get the handle of a textbox in an opened window using the function
EnumChildWindows(,,)..
after i obtained the handle of this textbox i want to set a specific
string in this textbox.
"HINT" : the function SetWindowText(,) isn't a valid to this task(why?)
more--->
the opened window has a textbox ,a button ,a label;
and when i used the spy++ program of Microsoft tools to get the caption
to each of them after using SetWindowtext(,),i observed that:
the caption of the label is same as the value appears on it<the
caption="" and="" value="" appears="" are="" equal="" to="" each="" other="" the="" string
posted="" by="" setwindowtext()=""> ,BUT
the caption of the textbox isn't the same as the value appears on it
<the value="" is="" nothing="" but="" the="" caption="" equal="" to="" string="" posted="" by=""
setwindowtext()="" function="">then i want an API function to set the value of the textbox not the
caption..
thank you very much for any help..
Sender :Amr abdel mohsen
Email: app_prog@yahoo.com
ÚãÑæ ÚÈÏ ÇáãÍÓä
|
|
|
|
|
Hi All
I am trying to include the inch symbol (ie " the same as a double quotation mark) in a function that requires a text string input between double quotation marks along the lines of: ?
SysAllocStringByteLen("Some text with the inch symbol" and then end",44)
How do I mark the " inch symbol so that it is not mistaken as the end of the text string
Regards
Jeremy
|
|
|
|
|
SysAllocStringByteLen("Some text with the inch symbol\" and then end",44)
|
|
|
|
|
Brilliant!! Many thanks for that!
|
|
|
|
|
I'm writting a function which send PostScript file directly to printer. Although it works, the paper is always the default size(A4).
To change paper size, I use SetPrinter(). But SetPrinter() need administrator privilege, and the printer is a shared printer of another computer in the network, which means no admin privilege can be got.
How to solve the problem f or setting paper size?
-------------------------------------------------------------------
PRINTER_DEFAULTS Defs;
PRINTER_INFO_2 *pPrnInfo2;
CPrintDialog dlg(TRUE);
DEVMODE *pDevMode;
CString szDeviceName;
HANDLE hPrinter;
DWORD dwNeeded;
if (dlg.DoModal() != IDOK) // select printer
return;
szDeviceName = dlg.GetDeviceName();
pDevMode = dlg.GetDevMode();
Defs.pDatatype = "RAW";
Defs.pDevMode = pDevMode;
Defs.DesiredAccess = PRINTER_ACCESS_USE; // if this, SetPrinter() failed
//Defs.DesiredAccess = PRINTER_ACCESS_ADMINISTER; // if this, OpenPrinter() failed
if (OpenPrinter((LPTSTR)(LPCTSTR)szDeviceName, &hPrinter, &Defs))
{
// Set Printer
GetPrinter(hPrinter, 2, 0, 0, &dwNeeded);
hGlobal = GlobalAlloc(GHND, dwNeeded);
pPrnInfo2 = (PRINTER_INFO_2 *)GlobalLock(hGlobal);
GetPrinter(hPrinter, 2, (LPBYTE)pPrnInfo2, dwNeeded, &dwNeeded);
pPrnInfo2->pDevMode->dmPaperSize = DMPAPER_A3;
if (!SetPrinter(hPrinter, 2, (LPBYTE)pPrnInfo2, 0))
TRACE("\n%d", GetLastError());
// Printing
DocInfo.pDocName = "EPS Document";
DocInfo.pOutputFile = NULL;
DocInfo.pDatatype = "RAW";
StartDocPrinter(hPrinter, 1, (LPBYTE)&DocInfo);
StartPagePrinter(hPrinter);
WritePrinter(hPrinter,....);
EndPagePrinter(hPrinter);
EndDocPrinter(hPrinter);
GlobalUnlock(hGlobal);
GlobalFree(hGlobal);
}
GlobalUnlock(pDevMode);
ClosePrinter(hPrinter);
|
|
|
|
|
For example i have written a program located on :
C:\..somewhere..\myprogram.exe
my problem is that i want to get the full path from where my program was launched.For example if my program is launched from C:\ProgramFiles\MyPrograms\Bin\myprogram.exe then i need to get this path.But i don't know how
Can anyone help ???
Regards,
m0n0
|
|
|
|
|
|
Thanks
m0n0
|
|
|
|
|
|
Thanks, it's really cool FAQ.
I found answer to a problem which mourned me for a long time i also wanted to do so that i was able to select full row in CListCtrl and it was explained here in one line , though i found many articles where this was achieved by writing several lines of code
m0n0
|
|
|
|
|
I am having a small problem using CRichEditCtrl on w9x (app built with VC6 sp6 on w2k). When I run the app on w2k, AfxInitRichEdit() loads RichEd32.dll which in turn loads RichEd20.dll that contains the code for version 3.0 of the rich edit control. But if I run the app on w98 the RichEd32.dll that gets loaded contains the code for version 1.0 of the rich edit control, and the control fails to be created. I tried to put the w2k copy of RichEd32 in the same folder as the app, but it does not get loaded, the app instead loads the older version found in the system directory. I had always had the understanding that the app would load the dll from the apps directory first before it went to the system directory, but apparently I was wrong on that. If I move the newer dll to the system directory, and remove the old dll, everything works great.
Question: Is it safe to redistribute the newer (v5) RichEd32.dll to w9x to replace the older (v4) dll that is already there? or is that just going to cause nothing but grief to other apps that may use the same dll? If I do that do I also have to redistribute RichEd20.dll? The RichEd dlls are not on the list of redistributable files that came with VC. I am guessing this is where the term "dll hell" comes from.
The only other option I can think of is not use MFC6's CRichEditCtrl, but to instead write my own wrapper that uses RichEd20.dll directly.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
I don't use W9x at all, so this based on reading MSDN, rather than practial experience, but the docs say that to use RICHED20.DLL, you have to call AfxInitRichEdit2 (note the '2' on the end).
|
|
|
|
|
I seen that to, but unfortunately that is a MFC7 function, it is undefined in MFC6.
[edit]
Or possibly my PSDK is out of date. Well either way I am going to write my own wrapper class to get around all the BS involved here. All I need are 6 functions and all MFC does is call ::SendMessage() so I can do that too.
[/edit]
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
We kind of have a similar problem with the VCF.
I solved by first explicitly loading RichEd20.dll, then calling CreateWindow (or the appropriate MFC Create() call).
According to MSDN RichEd20.dll is supposed to be on Win98 boxes. If it's not, it is safe to redistribute the RichEd20.dll. SUpposedly this goes for Win95 as well.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
Thanks, I ended up doing the same (load RichEd20.dll and calling Create()) and it seems to work perfectly. Just to be safe I will include RichEd20.dll in the installer, but only install it if it is not already there, I will not overwrite an existing dll.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
Hi Guys.
I posted this problem before, but now I've got the problem narrowed down
a bit. I made a network filetransfer program, with a client and a server.
When I build the client using MFC as a shared DLL, everything works perfectly.
When I build it using MFC as a static lib, the program produces a runtime
error when I try to initialize the sockets, i.e as soon as I try to send a
file. I have searched high and low, but I cant find any explanation, so if
anybody has tried something similiar, plz tell me about it
Shine
|
|
|
|
|
Are you including other DLL in your project? It depends upon how THEY were linked to MFC. For best results, ALL the DLL in your project should have linked to MFC the same way.
I am also wondering if you started other threads in the program? Did you use the CWinThread class to make the thread the sockets are using?
Chekc for uninitialized variables. Maybe the dynamic MFC has some intialization the static MFC does not, and you are missing it.
Lastly, what is the runtime error?
|
|
|
|
|
can anyone tell me how i can find out how much of proceeisng power my application is using...in temrs of percentage, or clock cycles or something like that. Would is an appropraute measure of seeing processor usage and how?
|
|
|
|
|
Ctrl-Shift-Esc brings up the Task Manager. Click on processes, and sort by use. When you see your app, click on it, sort by name and scroll until you can see it. Then you can monitor usage for as long as you like.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Mridang Agarwal wrote:
can anyone tell me how i can find out how much of proceeisng power my application is using...in temrs of percentage,
Task Manager?
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi everybody,
I have a simple editboxand i want to do so that the user was not able to type in my editbox symbols like : "?[]\/`<>"
i think you understand i want to do smth like , when you mark "Number" in CEdit options dialog and the user can't type any letters like "abcd...."
Can anybody help???
Regards
m0n0
|
|
|
|
|
Validation and regular expressions were made for each other...
One
Two
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
void DDV_ValidateResult(CDataExchange* pDX,CString& rstrResult)
{
if(pDX->m_bSaveAndValidate)
{
if (rstrResult.IsEmpty())
return;
for(int index=0; index < rstrResult.GetLength() ; index ++)
{
int nAsciiValue=rstrResult.GetAt(index);
if((nAsciiValue>=33 && nAsciiValue<=47) || (nAsciiValue>=58 && nAsciiValue<=64)
||(nAsciiValue>=91 && nAsciiValue<=96)|| (nAsciiValue>=123 && nAsciiValue<=126))
{
if(nAsciiValue!=46)//here 46 is .
{
AfxMessageBox("Please enter a valid value.");
pDX->Fail();
break;
}
}
}
}
}
|
|
|
|