|
heloo.. i solved the problem..
used CWnd *pwnd = CWnd::GetFocus();;
int wID = pwnd->GetDlgCtrlID();
thanks for the help
|
|
|
|
|
sonualex wrote: CFont *font = new CFont();
This variable should have class scope, and should not be a pointer.
sonualex wrote: once i click ok it changes the font of the first editbox alone.. how can i change the font of other 3 editboxes indivitually
Unless I'm just not understanding, what about:
if (FontDlg.DoModal() == IDOK)
{
font->CreateFontIndirect(&lf);
m_edit1.SetFont(&font);
m_edit2.SetFont(&font);
m_edit3.SetFont(&font);
m_edit4.SetFont(&font);
}
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
hi David..
nice to c u...
thanks for the reply....
below is my code... it worked fine
i used the font pointer here.. dint understand y v cant use pointer...
CWnd *pwnd = CWnd::GetFocus();;
int wID = pwnd->GetDlgCtrlID();
LOGFONT lf1;
CFont *font1 = new CFont();
switch(wID)
{
case IDC_EDIT1:
{
CFontDialog FontDlg1(&lf1);
if(FontDlg1.DoModal() == IDOK)
{
font1->CreateFontIndirect(&lf1);
m_edit1.SetFont(font1);
}
}
break;
}
|
|
|
|
|
sonualex wrote: i used the font pointer here.. dint understand y v cant use pointer...
Because it's completely unnecessary.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
ok.. thanks for that too..
|
|
|
|
|
Hello,
I have developped an ActiveX control using MFC which works flawlessly in any application, but randomly crashes when run in Internet Explorer. So I made a debug build of my control, and set iexplore.exe as the running process for debugging.
However, when I press F5, IE starts, and I can open the HTML file that has my activeX included, but I do not halt at any breakpoints. When I do the same with my testapp.exe, the same procedure works fine. What do you have to do in order to debug an ActiveX that is currently running in IE?
|
|
|
|
|
If you are using IE8, you can uninstall it and try with IE7.
|
|
|
|
|
Hi,
I am trying to automate the clicking of context menu items.
How do i click the items after the context menu is poped up on mouse right click.
Please any one there, your help is greatly needed
|
|
|
|
|
Use mouse_event API [^]
Величие не Бога может быть недооценена.
|
|
|
|
|
Thanks fo rur help.
I have one more question. How to find the position of the menu items?
|
|
|
|
|
Hello everyone !
I forget it,but I vaguely remember the function like this :
int MessageBoxTimer(<br />
HWND hWnd, <br />
LPCTSTR lpText, <br />
LPCTSTR lpCaption, <br />
UINT uType<br />
UINT uElapse, <br />
);
I don't want use FindWindow to close it,, thanks for you help !
Best Reguards!
|
|
|
|
|
|
Hi, I'm trying to make an application in MDI MFC with multiple view classes for a single doctemplate. I would like to be able to display the new CRecordView class by clicking on it's name from a menu. I really at a loss of how to do this, anyones input would be greatly appreciated and some code showing the method would be a life saver.
Thanks
|
|
|
|
|
You can use CDocument::AddView[^] to add a new view to the existing document.
You have to create a new view class which is derived from CView and then add it to the view.
You can use the ShowWindow API to show and hide the views.
Look at the sample code in the documentation.
|
|
|
|
|
Hi All,
I'm porting some old code to run on Vista/7 and have run across some odd behaviour. The app in question is creating windows controls via the MFC call CreateEx to create a PushButton. While the button is created in the dialog, it has a strange artifact around it. Somtimes it's a distinct black border that fades away when the mouse is not near it, sometimes it has some grey dots surrounding it, and sometimes it looks like an extra line is being drawn on one side. It's almost as if part of the code thinks it's an older comctrl32 and parts a new comctrl32. I have ensured there is a manifest file with the linker directive to use common-controls 6, but to no avail.
Anyone seen this before or have a suggestion to try?
Thanks in advance!
Anthony
|
|
|
|
|
This sounds like the default button styles.
The black border denotes a default button and the grey dots indicate that the button has focus.
|
|
|
|
|
I think I wasn't clear enough... This is not "normal" behaviour. For example, the black "border" may only draw part of a side. The grey "dots" may have one side solid and another partially covered. Hovering a mouse over the control may see all sorts of interesting transitions. Solid black fading to grey dots, or suddenly clearing away to show the background window colour.
There is a conflict somewhere in the code (I wasn't clear that on XP this code works fine). MS suggested that my manifest file may be incorrect, but I have not been able to find anything wrong with it.
|
|
|
|
|
Create a program that allows the user to enter a password.
1-All vowels (A, E, I, O, and U) in the original password are replaced with the letter X.
2-All numbers in the original password are replaced with the letter Z.
3-All the characters in the original password are reversed.
My question is I'm getting two errors and honestly, I'm not sure how to fix them!
error C2109: subscript requires array or pointer type
error C2664: 'strcat' : cannot convert parameter 1 from 'int' to 'char *'
<br />
#include <string><br />
#include <iostream><br />
<br />
using std::cout;<br />
using std::cin;<br />
using std::endl;<br />
using std::string;<br />
<br />
int main(int argc,char *argv[], int rpass, int passwdlen, int passwd)<br />
{<br />
<br />
char *a,*b,c; <br />
int t,e; <br />
if (argc<2) return(0); <br />
a=argv[1]; <br />
b=a; <br />
e=strlen(b); <br />
for (t=0;t<=e;t++) <br />
{ <br />
c = *b; <br />
if (c>='A'&&c<='Z') c -= 'A'-'a'; <br />
if (c=='a'||c=='e'||c=='i'||c=='o'||c=='u') b++; <br />
else *a++ = *b++; <br />
} <br />
<br />
if( c >= '0' && c <= '9' )<br />
char repass[256];<br />
for (int i=passwdlen-1; i>=0; i--) strcat(rpass, passwd[i]);<br />
<br />
system("pause");<br />
return 0; <br />
}
|
|
|
|
|
Chris0812 wrote: if( c >= '0' && c <= '9' )
char repass[256];
for (int i=passwdlen-1; i>=0; i--) strcat(rpass, passwd[i]);
The if condition looks like it is creating repass if the condition is met and nothing more.
I believe the first parameter of strcat must be repass which is a character array and not rpass which is an integer passed in as parameter.
Chris0812 wrote: int main(int argc,char *argv[], int rpass, int passwdlen, int passwd)
I've never seen such a main function with so many parameters.
That wouldn't work.
main takes a max of 3 parameter - int main(int argc, char* argv[], char* envp[])
And to reverse a string you can use strrev .
Also you can use strtok to search for a token within a string like "aeiou" .
|
|
|
|
|
Honestly, I don't get it...this is my first programming class and it will be my last!
This is the hardest assignment so far.
|
|
|
|
|
Okay, now the only erroe I'm getting is C2065, undeclared identifer....
passwdlen, repass and passwd
|
|
|
|
|
So just declare them (like the other variables).
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I am working on an application that have to retrive something after the javascript timer timesout... like there in rapidshare you have a js timer, when it times out you are shown the link...
Now the problem is
I have used WININET to do http work
send a url to server
retrive the response
I found that the javascript part, which when i saw page source in browser was something like
<html>.....
.......
...</html>
<script>..... JS Part
</script>
Now in the reponse em getting, there is no script part, but there is other js parts. i have tried changing the USER - AGENT .. Plz reply, no MFC, just winapi please..
|
|
|
|
|
The HTML you got back, is that the right one you were expecting?
-Suhredayan
|
|
|
|
|
ok I am done with that,I was actually working on a web crawler, actually a file crawler. I tricked out some php dlls and loaded it in my Win32 app and used it to retrive source and it is working pretty cool.
|
|
|
|