|
Dear all,
I want to write a programe that:
1. A dialog box is prompted at the beginning, but the browser will be activated after the user has input the information in the dialog box.
2. The process of the dialog box is stilling running at the backend.
3. If the user input some HotKey such as Ctrl+q/Ctrl+l/Ctrl+f..., the process of my application can receive these keyboard hotkey command and jump to perform another process.
How can I receive these keyboard command and also, how to identifiy the command is equal to Ctrl+q or Ctrl+l...?
Looking forward for your reply. Thx a lot!
|
|
|
|
|
I am trying to develop a toolbar application using COM - that is a COM obj. that only impliments a toolbar. Currently I have designed it as follows - an ATL CDialogImp derived class with the class containing a CToolBarCtrl (MFC) as a member.
MyClass : CDialogImp<>
{
CToolBarCtrl m_MyTB;
}
Things haven't been easy but it is almost done, the only outstanding issue is hotkeys for the toolbar buttons. I still have 2 problems when the toolbar has the TBSTYLE_FLAT style. Toolbar buttons with borders works fine.
1. If there is no 'hotkey' provided (using an '&' in the button text) the MFC toolbar defaults the first letter of the button text as the 'hotkey'. Another similiar issue is the underline indicating a hotkey does not always appear ??
The MFC toolbar is supposed to be doing all this under the covers I'm assuming because there doesn't seem to be a way to access it.
2. If the default hotkey (from 1.) is pressed and NOT the ALT key, the button becomes HOT (i.e. looks raised), and if the the same key is presed again the whole thing crashes
I'm new to MFC/COM any suggestions would be greatly appreciated.
|
|
|
|
|
I have PIDL (absolute) of the folder and I want to know number of items (subfolders (normal, hidden, etc.) and files) in this folder. How can I do it with Shell?
|
|
|
|
|
Maybe you could use CFileFind?
Get the path from the PIDL (dumb acronymn )
and call an fn like this one:
int FindFiles(LPCSTR lpszPath)
{
int iFileCount = 0;
CFileFind fnd;
if (fnd.FindFile(lpszPath)) {
do {
if (!fnd.IsDots() && !fnd.IsDirectory()))
iFileCount++;
if (fnd.IsDirectory())
iFileCount += CountFiles();
} while (fnd.FindNextFile(fnd.GetFilePath()));
}
fnd.Close();
return iFileCount;
}
I'm not sure this will work -- I might have forgotten
something. Notice that the fn calls itself recursively
if it finds a folder, so it will find all the files in
that folder too.
Regards,
Daniel
|
|
|
|
|
How do i change the color, in a dialog base App, i want to change the background color of the dialog, from old boring gray to green..
Thank you for you help
|
|
|
|
|
Look for WM_CTLCOLORDLG in MSDN. That should
be what you're looking for.
Regards,
Daniel
|
|
|
|
|
I got a small problem ...
I'm using CArray<> which I define like this:
typedef CArray<"CListCtrlEx, CListCtrlEx&"> Type_aCListCtrlEx;
Type_aCListCtrlEx m_aCListCtrlEx;
(WHEN I PREVIEWED THE POSTING I HAD PROBLEMS WITH <> THEREFOR I
ADDED THE " SO THAT NO CODING ERROR)
Where CListCtrlEx is a CListCtrl derrived class.
Then I do this to add a new CListCtrlEx class to the array:
CListCtrlEx wndList;
m_aCListCtrlEx.Add(wndList);
The problem is that it first gave me copy contructor needed and =operator not found error. So I tried to solve it in the CListCtrlEx class like this:
HWND operator=(CListCtrlEx &s)
{ return s.GetSafeHwnd(); }
CListCtrlEx(const CListCtrlEx &s) {}
I do not know if this is the correct way to do it.
But when I try to retrive the CListCtrl wnd handle to use its methods etc like this it doesn't work:
CListCtrlEx wnd;
wnd = m_aCListCtrlEx.GetAt(0);
If someone could gimme a few hints I would be forever greatfull ...
Cheers,
Henrik
|
|
|
|
|
try using pointers to the list controls, instead of references. this way, you avoid "=" operator problems, construction and destruction problems.
-c
|
|
|
|
|
There is no copy constructor for the CArray class. So you have to define one by inheriting the CArray class.
leonwoo
|
|
|
|
|
Does anybody know how to create an unique number runtime?
I would like a number that is just as unique as a GUID.
|
|
|
|
|
a GUID is essentially a 16 BYTE number. so, if you can generate 4 random int's, you're all set.
the "uniqueness" of your number depends on what you use for seed values. even with :
seed(0);
int i1= rand();
int i2= rand();
int i3= rand();
int i4= rand();
you didn't say you needed crypto-strength random values (which these really aren't) or just statistically random values. statistally speaking, there's a lot of room in 2^128, so you should be OK.
a GUID is partly based on machine-specific data (usually your network card's address). so if you can get at that data, you can use it, too.
-c
|
|
|
|
|
Sorry, I know this is not the right page but I´m looking for someone who`s really good in creating
grafix for user-interfaces.
If you think you`re the one who will create the grafix ( background, switches etc. ) for our apps
(almost music-based)than write a short mail maybe with an example of your work to:
mario@klangwerker.de
Greatings Mario ///
... Coding is one thing - be creative another one ...
----------------------
www.klangwerker.de
mario@klangwerker.de
rocknix@lycos.de
----------------------
|
|
|
|
|
Usually programmers are not good artists.
Try looking here: http://www.fli7e.de/
He does Winamp skins -- that's a UI. Quite good, too.
If he won't, you *might* find someone on this ring who would be
interested, and you can look at their work first.
Regards,
Daniel
|
|
|
|
|
I have an edit control in my dialog box and i want create a function that set or change the position of my Edit control.
Thank you in advance
|
|
|
|
|
Do you mean the position of the actual control or the position of the caret (the blinking text cursor)?
If you want to move the whole control, use the MoveWindow function (from CWnd).
If you want to move the caret, use SetSel(), using the position you want the caret to be in as the first two parameters.
Regards,
Peter Pearson
|
|
|
|
|
Hi Guys,
How to connect Pop3 server or Imap server.
If there is any API there to connect.(in C++/VC++).
How to retrive mails from my server with using c++ api.
|
|
|
|
|
Either write you own implementation of the protocol (Search for the RFCs on the web).
If you want to interface to Microsoft's mail API's, you need to examine the MAPI
interface. Good luck. I found the documentation to be, er, less than helpful
when dealing with MAPI. Not as good as the rest of the documentation.
I think the platform SDK and MSDN have some sample MAPI code.
Stephen Kellett
|
|
|
|
|
I have a lot of experience here - and you will save a fortune by investing a few hundred dollars into a library such as the Dundas TCP/IP stuff. However, POP3 is a pretty simple protocol, and once you have the RFC, it is quite easy to work it out. There is sample code on this site for sending messages (SMTP) abnd POP3 isn't much different. Simply connect to a server on TCP port 110 and send a few commands. Avoid MAPI like the plague - in many cases, it assumes an MS only environment and is a waste of time. I have been coding mail apps since 1992 and MAPI sucks. Stick to decent Internet standards (POP3/SMTP) and you can't go wrong.
Regards.
|
|
|
|
|
A starting programmer needs help
I turn here for help. Please help me,
I am using CString because I am coding for Windows CE. I run my code through Visual Studio to use the console to make sure its working. the aim is to try and cut up a string into many pieces. but I can't even output a simple string.(this saddens me)
Example Code:
CString hd ("test");
LPCTSTR h = hd;
CString *lk;
lk = hd;
printf("%s", hd);
printf("%s", (LPCTSTR)hd);
printf("%s", h);
cout << h;
cout << lk;
cout << *lk;
My Problem:
For the printf function the only thing I get is always the first character 't';
for the cout, I always get the memory location in all cases, so what I am asking is, CAN SOMEONE TELL ME HOW I CAN PRINT OUT THE FULL STRING....PLEASE!!!!
thank you
lonod
To Code or not to code, that is the question
|
|
|
|
|
A starting programmer needs help
I turn here for help. Please help me,
I am using CString because I am coding for Windows CE. I run my code through Visual Studio to use the console to make sure its working. the aim is to try and cut up a string into many pieces.
Example Code:
CString hd ("test");
LPCTSTR h = hd;
CString *lk;
lk = hd;
printf("%s", hd);
printf("%s", (LPCTSTR)hd);
printf("%s", h);
cout << h;
cout << lk;
cout << *lk;
My Problem:
For the printf function the only thing I get is always the first the first character 't';
for the cout, I always get the memory location in all cases, so what I am asking is, CAN SOMEONE TELL ME HOW I CAN PRINT OUT THE FULL STRING....PLEASE!!!!
thank you
lonod
To Code or not to code, that is the question
|
|
|
|
|
printf("%s", hd);
This doesn't work because sending a CString to printf() is meaningless. You must cast it to (LPCTSTR).
--Mike--
http://home.inreach.com/mdunn/
This must be Thursday. I never could get the hang of Thursdays...
|
|
|
|
|
Thanks for quick reply mike,
if you notice I did cast it to LPCTSTR in the next printf function, but all i still got was the first character of the string.
To Code or not to code, that is the question
|
|
|
|
|
Ah, it's probably because you're using printf() when you should be using wprintf(). CE is a Unicode OS, so when you pass a Unicode string to printf(), it views the string as an ANSI string. The first byte is 't' and the second byte is 0.
Also, use wcout instead of cout, and add (LPCTSTR) casts to your CStrings to make sure they're being passed as C strings instead of C++ objects.
--Mike--
http://home.inreach.com/mdunn/
This must be Thursday. I never could get the hang of Thursdays...
|
|
|
|
|
I'm developing a program required to use Synchronization function WaitForSingleObject(). It may take several seconds or longer to run this function, therefore, I want to add a Progress Bar control to let the user knows how long do they need to wait. However, I cannot find the source code of this WaitForSingleObject() function, so I cannot put the progress bar SetPos() in that function. I've tried to set the progress bar move by timer...but when the program run WaitForSingleObject(), the progress bar stopped and start move again after WaitForSingleObject().
Can I do it in this way???::
If originally the timeout value is 16000....(WaitForSingleObject(xxxx, 16000)), then I split it into ... let say....5 ......e.g.:
WaitForSingleObject(xxxx, 3200);
Call ProgressBarControl;
WaitForSingleObject(xxxx, 3200);
Call ProgressBarControl;
WaitForSingleObject(xxxx, 3200);
Call ProgressBarControl;
WaitForSingleObject(xxxx, 3200);
Call ProgressBarControl;
WaitForSingleObject(xxxx, 3200);
Call ProgressBarControl;
So that the progress bar can update every 3200 time interval?.....
Or do anyone have another suggestion on using WaitForSingleObject with Progress Bar?? I must use this WaitForSingleObject function......
Sorry...I just a beginner in MFC programming;P
|
|
|
|
|
Instead of WaitForSingleObject could you not use MsgWaitForMultipleObject just before the thread is about to do it's stuff create a Timer that fires every second. when MsgWaitForMultipleObjects returns determine what's happened has the thread finished or do you have a windows msg i.e. WM_TIMER.
if this is appropriate you could have a class variable that indicates what step the thread is up to - wrapped by a CriticalSection so you can update your UI accordingly.
|
|
|
|