|
Brother this is code for your program
hope it work
<br />
void main();<br />
{<br />
int nLength=0;<br />
char *szData;<br />
cout<<"\nEnter he Length of string : ";<br />
cin>>nLength;<br />
szData=new char[nlength+1];<br />
getline(szData,nLength);<br />
cout<<endl<<"YOu have enter : "<<szData;<br />
int Vowels=0,Spaces=0,Digit=0; <br />
char ch=0;<br />
for(int i=0;i<nlength;i++)<br />
{<br />
if(isDigit(szData[i]))Digit++;<br />
if(szData[i]==char(32))Spaces++;<br />
ch=toupper(szdata[i]);<br />
if((ch=='A')||(ch=='E')||(ch=='I')||(ch=='O')||(ch=='U'))Vowels++;<br />
}<br />
cout<<endl<<"NO Of Vowels : "<<Vowels;<br />
cout<<endl<<"NO Of Spaces : "<<Spaces;<br />
cout<<endl<<"NO Of Digits : "<<Digit;<br />
<br />
getch();<br />
}
pls remove some compiler error if occur
-----------------------------
"I Think It will Work"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
tiziacaia wrote:
When I add the object library for MS Word the file "msword.h" isn't created.
The example uses "msword8.h", which is for Word 97 (versions 8). The version number will be different; I believe it will be version 11, although I haven't tested it. Try "msword11.h" instead - or look for a similar file in your project directory.
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"
|
|
|
|
|
I tried with "msword11.h" too but don't work. In the project directory there aren't files with similar name.
I don't understand where i miss.
Thaks.
|
|
|
|
|
When you want automation, you need to read a lot about it. I don't have experience with it myself, but I have written an application calling Word and it doesn't have an msWord.h file.
You have to import a sort of Object or component from your Word program. Every Microsoft Office version has another one. (you can find which one on msdn.)
Only advise I can give you is read and search.
PS: For Office 2003 it's not MSWord11 but MSWORD
I think you need the MSWORD.OLB file (somewhere in your office directory)
good luck and I hope this helps at least a little.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
I'm trying to get work this example
Microsoft example[^]
When I add the object library for MS Word the file "msword.h" isn't created.
I'm using Visual c++ .net and Word 2003.
Somebody can help me?
Thanks a lot!
TiziaCaia
|
|
|
|
|
/* I have spent the last few days reading the articles on dlls and am still as lost as when I began.
If anyone can point (kick) me in the direction that I need to solve this problem I'd be grateful.
*/
All I want to do is to place a bitmap into a dll.
Then from my exe call the resource for usage. eg LoadBitmap(IDB_BITMAP)
/* So whats the best way of going about doing this?
Some working sample code would be great
*/
|
|
|
|
|
off the top of my head
1) call LoadLibrary to load the dll
2) call LoadBitmap passing the handle returned from step 1
HINSTANCE hMyDll = LoadLibrary("Somedllwithbitmap.dll")
ASSERT(hMyDll);
HBITMAP hBmp = ::LoadBitmap(hMyDll, MAKEINTRESOURCE(IDB_SOMEBMP));
ASSERT(hBmp);
CBitmap *pBmp = CBitmap::FromHandle(hBmp);
use pBmp
//clean up not so sure about this bit, check the doco
delete pBmp;
FreeLIbrary(hMyDll);
|
|
|
|
|
Ok, I had been doing something similar without success,
maybe I didn't make the dll correctly to start with.
Thanks for your help.
|
|
|
|
|
since this a VC++ forum, you can use your VC++ to create a windows dll and export the dll function.
I am sitting in my flame proof buncker, so don't even bother.
by the way, perl stinks.
|
|
|
|
|
that sounds way over my head in ability I'm afraid.
|
|
|
|
|
you'r going to have to learn....here are a series of beginner tutorials.
I am sitting in my flame proof buncker, so don't even bother.
by the way, perl stinks.
|
|
|
|
|
Hi there,
I have some variable-height controls which need to have some vertically-centered text written on them. My question is: knowing the height the text should occupy, what do I have to do in order to create a point-font?
Thanks a million,
David
|
|
|
|
|
Not really sure what you mean with a point-font, a a font in typographical points? Why not use the height of the control, deduct some margin and create the font with CreateFont using the resulting height?
|
|
|
|
|
Hey there!... and thanks for the reply.
I take it then that there is no way to use the simple BOOL CreatePointFont( int nPointSize, ...) function? I was wondering if there was a way of converting point-size to LP?
David
|
|
|
|
|
Well there is. You get the client CDC , call GetDeviceCaps(LOGPIXELSY) to get the vertical resolution per inch of the output CDC . After this, you divide the result with 72, and gets the height in pixels for a typographical point (you'd obviously have to use double values to do this). Finally, you divide the height of your control with the number of pixels-per-typographical-points calculated, and you're home.
Far easier to just use the height from the beginning
|
|
|
|
|
Ahhh... I see now!
I think that I am going to take your first suggestion -- it is by far better doing so.
You have been very helpful Johan. Thanks a million.
David
|
|
|
|
|
if i have a file(maybe *.asf, *.avi) use MPEG4 or MPEG2 compress.
how to play this file in my execute file~??
|
|
|
|
|
Hello,
The first time I call gethostbyname() in my program, it creates a new thread called "Win32 Thread" in VS.net. Subsequent calls don't create new threads, but the original one never goes away.
This isn't really much of a problem, but if anyone can tell me more about this, please let me know.
Thanks,
Donkey
|
|
|
|
|
Hi
I am writing a project with MFC.
the project has two window's one for logic circuits, and one for state machines. after building the state machin i got a circuit which i have to layout on the circuit view, but i don't understand how to open the circuit window.
the windows are built dynamic, and on new the program asks what kind of window to open.
any help on how to open a new window, or an example that does that will be much appriciated.
10X in advance
sagi
|
|
|
|
|
If you are creating an MDI app, then you need to create a separate view and document for each type of view you wish to display. Use your app class InitInstance function to add the new doc/view to your template. Do some searching at www.msdn.microsoft.com.
I am sitting in my flame proof buncker, so don't even bother.
by the way, perl stinks.
|
|
|
|
|
Here is an out of control bot. Once the ok dialog button is clicked, the bot works ok, but there is no way to interact with the status bar icon. Before ok is clicked, status icon is responsive, but after clicking, there is no answer, and the only way to interrupt the routine is under debug or by ctl-alt-del shutdown of the process.
I've got one of the much-sought-after free G-Mail account to the first person who can find the mistake here.
Here is an outline of the code:
in BotDlg.h
#define WM_TRAY_NOTIFY WM_USER + 0
...
...
class CBotDlg : public CDialog
{
// Construction
public:
CBotDlg(CWnd* pParent = NULL); // standard constructor
LRESULT OnTrayNotify(WPARAM wParam, LPARAM lParam);
void TakeABreak();
void BackToWork();
void OnMenuExit();
NOTIFYICONDATA m_nTrayData;
bool m_bOnBreak;
bool m_bHidden;
...
...
in BotDlg.cpp
...
...
BEGIN_MESSAGE_MAP(CBotDlg, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_MESSAGE (WM_TRAY_NOTIFY, OnTrayNotify)
ON_COMMAND(IDC_BREAK, CBotDlg::TakeABreak)
ON_COMMAND (IDC_WORK, CBotDlg::BackToWork)
ON_COMMAND (IDC_EXIT, CBotDlg::OnMenuExit)
ON_BN_CLICKED(IDOK, OnBnClickedOk)
END_MESSAGE_MAP()
...
...
m_nTrayData.cbSize = sizeof(NOTIFYICONDATA);
m_nTrayData.hWnd = m_hWnd;
m_nTrayData.uID = 0;
m_nTrayData.hIcon = LoadIcon (AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_BREAK));
m_nTrayData.uCallbackMessage = WM_TRAY_NOTIFY;
strcpy (m_nTrayData.szTip, "Bot");
m_nTrayData.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
m_bOnBreak = false;
m_bHidden = false;
return TRUE; // return TRUE unless you set the focus to a control
...
...
// ******************************
// * *
// * Main Process *
// * *
// ******************************
//
// Main Process
//
void CBotDlg::OnBnClickedOk()
{
//go retrieve web pages and follow links
//til no more links
EndDialog(0);
}
// ******************************
// * *
// * OnTrayNotify *
// * *
// ******************************
//
// Tray Notification Handler
//
LRESULT CBotDlg::OnTrayNotify(WPARAM wParam, LPARAM lParam)
{
// ---- Left-button dclick: Exit Program
if (lParam == WM_LBUTTONDBLCLK)
{
Shell_NotifyIcon(NIM_DELETE, &m_nTrayData);
EndDialog(0);
}//end if
// ---- Right-button down: Pop-up menu
if (lParam == WM_RBUTTONDOWN)
{
CMenu menu;
VERIFY (menu.LoadMenu(IDR_MENU1));
CMenu* pPopup = menu.GetSubMenu(0);
ASSERT(pPopup != NULL);
CRect screen;
GetDesktopWindow()->GetWindowRect(screen);
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, screen.right, screen.bottom, AfxGetMainWnd());
}//end if
return LRESULT(0);
}
// ******************************
// * *
// * BackToWork *
// * *
// ******************************
//
// Back to Work Handler
//
void CBotDlg::BackToWork()
{
m_nTrayData.hIcon=LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_WORK));
strcpy (m_nTrayData.szTip, "Bot");
m_nTrayData.uFlags = NIF_ICON | NIF_TIP;
Shell_NotifyIcon (NIM_MODIFY, &m_nTrayData);
}
// ******************************
// * *
// * TakeABreak *
// * *
// ******************************
//
// Take A Break Handler
//
void CBotDlg::TakeABreak()
{
m_nTrayData.hIcon=LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_BREAK));
strcpy (m_nTrayData.szTip, "Bot");
m_nTrayData.uFlags = NIF_ICON | NIF_TIP;
Shell_NotifyIcon (NIM_MODIFY, &m_nTrayData);
}
|
|
|
|
|
I have no use for the "much sought after" GMail account, but perhaps I can solve your problem.
I assume that you are talking about an System Tray area icon that is created and maintained by the program. Now, it seems that after you end the dialog by clicking the Ok-button, you also destroy the dialog window. This window is also marked as the parent of the tray area icon (it's message map has a hander for the tray notification). When the window is destroyed, the tray area icon has no window attached to it, and it will start to behave irrationally.
The way to fix this is to move the adding of the tray area icon INSIDE the dialog's main initialization code (to CDialog::OnInitDialog , for example). Then you should create a supplementary function (call it, for example, CBotDlg::DestroyTrayIcon ). This function is responsible for removing the icon from the tray area.
Now go through your code. Everywhere where you are calling CDialog::EndDialog , you should add a call to CBotDlg::DestroyTrayIcon before the EndDialog call. This makes sure that once the dialog window is destroyed, the tray area icon no longer exists, and can no longer cause irrelevant behaviour.
If your idea is to create and upkeep the tray area icon AFTER the dialog has been destroyed, then you need to create another window that is responsible for handling messages sent by the tray icon. The basic idea is that the tray area icon is always bound to an existing window. If this window gets destroyed with the tray area icon still there, it will lead to unpredictable behaviour.
UPDATE: After reading more of your code sample, it became apparent that your problem is in the dialog window. The tray area icon is bound to the dialog window, but you're destroying the window when EndDialog is called. This leads the tray icon to stop responding. Fixing it is easy: instead of ending the dialog, use ShowWindow to hide the window from sight (minimize to tray), or create a dummy window with no other purpose than to answer to the tray area notifications.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Kitos for the suggestions, but the dialog box doesn't get destroyed until the end of the main routine. The main routine can run for days, that's why I need to interrupt it sometimes. End dialog only happens at the end and then everything appears to terminate normally.
I have experimented with early enddialog and hiding and minimizing the dialog box. You're right, early enddialog leads to unpredictable results. What is also curious and probably related is that when the ok button is clicked, the resulting minimized window also becomes unresponsive, i.e., can't repaint it by clicking on it.
|
|
|
|
|
move ur return LRESULT(0) within the parantheses.It shud work.
|
|
|
|
|
You mean into the prior if statement?
|
|
|
|