|
I was actually trying to code to open multiple files with no extensions those were inside a folder. I looked up for methods but I coudn't find. Please help me with this as soon as possible. Can I do so with turbo C++??
|
|
|
|
|
|
I was actually trying to code to open multiple files with no extensions those were inside a folder. I looked up for methods but I coudn't find. Please help me with this as soon as possible. Can I do so with turbo C++??
|
|
|
|
|
I have a problem with a 3 state check box (push style) with new common controls 6.0 vista look, no problem with older common controls. I have created a very simple application of one button if someone needs the code, where I want the check box(which really looks like a push button) to behave as 3 different state, ( ON -I set to a color), (OFF- I set it to another color), (INdeterminate- I want it to be Gray or something), works fine for ON & OFF, but 3rd state, somehow the text seems to get shifted or something on the button, it shows half gray, half red..... Anyone with similar problem...here is the meat of the code...Keep in mind, it works fine if I don't use it as tri-state, or if I don't use common controls 6.0 with the linker.
Thanks
void CColoredButton::OnClicked()
{
if(!m_IsEnabled){
SetCheck(FALSE);
return;
}
if(GetCheck()==2){
ModifyStyle(BS_BITMAP,0);
InvalidateRect(NULL);
}
else{
ModifyStyle(0,BS_BITMAP);
SetColoredCheck(GetCheck(),m_FontSize);
}
WPARAM wParam=MAKEWPARAM(GetDlgCtrlID( ),BN_DOUBLECLICKED);
GetParent()->SendMessage(WM_COMMAND,wParam ,(LPARAM)m_hWnd);
}
void CColoredButton::SetColoredCheck(int nCheck,int FontSize)
{
COLORREF Color = m_UpColor;
if(nCheck==1)
Color=m_DownColor;
if(nCheck==2)
Color=RGB(255,0,0);
CString Label=GetText(FALSE);
CRect Client;
GetClientRect(Client);
CClientDC dc(this);
CDC dcMem;
dcMem.CreateCompatibleDC(&dc);
CFont* pFont = GetFont();
CFont MyFont;
m_FontSize=FontSize;
CBitmap* pOldBitmap = dcMem.SelectObject(&m_Bitmap);
CBrush brBackground(Color);
CBrush *OldBrush=dcMem.SelectObject(&brBackground);
dcMem.SetBkColor(Color);
dcMem.FillRect(Client, &brBackground);
if(!m_IsEnabled){
CBrush *PHalfBrush=dcMem.GetHalftoneBrush( );
if(PHalfBrush!=NULL)
dcMem.FillRect(Client, PHalfBrush);
}
CFont *OldFont=dcMem.SelectObject(pFont);
int OldBkMode = dcMem.SetBkMode(TRANSPARENT);
dcMem.DrawText( Label, Client, DT_CENTER | DT_VCENTER |DT_SINGLELINE );
dcMem.SetBkMode(OldBkMode);
dcMem.SelectObject(pOldBitmap);
dcMem.SelectObject(OldFont);
dcMem.SelectObject(OldBrush);
if(FontSize>0)
MyFont.DeleteObject();
dcMem.DeleteDC();
SetBitmap( HBITMAP(m_Bitmap) );
SetWindowText(Label);
SetCheck(nCheck);
}
sft
|
|
|
|
|
Sorry about the long code, In summary, THis is what I want
void CColoredButton::OnClicked() {
if(GetCheck()==2){
ModifyStyle(BS_BITMAP,0);
InvalidateRect(NULL);
}
else{
ModifyStyle(0,BS_BITMAP);
SetColoredCheck(GetCheck(),m_FontSize); }
......
When GetCheck() ==2 for the indeterminate state, it always worked where the button was pretty much disabled or Kindda grayed out, but with the new common controls, its not the case any more, the text somehow gets overlapped and shows 2 different colors... Any idea what the problem might be there, or how I can may be get around this?
sft
|
|
|
|
|
Hello All
I am planning to write an application using VC++ to find the free-meeting rooms in my office. All the meetings rooms are listed in outlook. what i am doing right now is to run thru all the meeting room one by one to find the free one for a perticular time. is there any way i can connect to
MSoutlook calender using VC++ program and search for a free room?
Thank you
|
|
|
|
|
I don't know if this is possible (I guess it is) but if it is possible, it would be done through automation. Google for "outlook automation" and you'll get plenty of examples.
I'm not an expert in automation, so it's the only help I'm able to provide...
|
|
|
|
|
Yes - you need to connect to Outlook through COM (use ProgID "Outlook.Application") and naviagte its object model.
Best way to investigate the Outlook object model is to use Outlook's VBA IDE - use the object browser or something like that.
BTW - it's really a lot easier with VB6 than C++...
|
|
|
|
|
Hi All,
Is there a way of limiting the size of the margins when printing.
At present I can't think of a better way than subclassing the pring dialog box and intercepting text input to the margin size edit boxes.
The reason for this is that our test team have complained that if they put a huge number into the text margin boxes it messes up the appearance of the document and so should be prevented. Can you believe it
Cheers
Tom
Philosophy: The art of never getting beyond the concept of life.
Religion: Morality taking credit for the work of luck.
|
|
|
|
|
I've done a bit of digging, and neither PRINTDLG or PRINTDLGEX have a margins member.
So these margins you are talking about are app dependent, so we'd need to know more about the context.
If this is a custom print box, then start looking at the code there...
Iain.
ps, Good surname...
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
Hi Iain,
The actual dlg box in question can be seen in IE. If you click on print preview, the window that comes up has a button which fires up a page setup dialog box. It is on this that the margins can be altered. Sorry for the lack of clarity.
ps. Best damn surname there is...
Cheers
Tom
Philosophy: The art of never getting beyond the concept of life.
Religion: Morality taking credit for the work of luck.
|
|
|
|
|
If you are discussing about the page Setup dialog that you use in your own application, i also think so, you may need to subclass the dialog.
First of all, obviously, if the margins are overbound it messes up, that is known to the user, do you need to correct it?
If you want to disable the margin fields, simply use PSD_DISABLEMARGINS flags in [PageSetupDlg Function^].
Or you can validate the margin data entry, by subclassing it. That is setting the hook procedure.
PAGESETUPDLG psd;
ZeroMemory(&psd, sizeof(psd));
psd.lStructSize = sizeof(psd);
psd.hwndOwner =
....
psd.Flags = PSD_INTHOUSANDTHSOFINCHES | PSD_MARGINS |
<code>PSD_ENABLEPAGESETUPHOOK</code>;
psd.lpfnPageSetupHook = (LPPAGESETUPHOOK)PageSetupHook;
if (PageSetupDlg(&psd)==TRUE) {
And in the hook procedure you can validate the text entry,
BOOL CALLBACK PageSetupHook(HWND hwndDlg, UINT uMsg, WPARAM wParam,
LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
return (INT_PTR)TRUE;
case WM_COMMAND:
if ((LOWORD(wParam) == 1155
&& HIWORD(wParam) == EN_CHANGE)
{
You can completely customise the page setup dialog with your own dialog by create a dialog template resource by modifying the default template available in VC\PlatformSDK\Include\PrnSetup.Dlg by specifying the flags,
psd.Flags = PSD_INTHOUSANDTHSOFINCHES | PSD_MARGINS |
PSD_ENABLEPAGESETUPHOOK | <code>PSD_ENABLEPAGESETUPTEMPLATE</code>;
....
psd.lpPageSetupTemplateName = MAKEINTRESOURCE(IDD_PAGESETUP);
psd.lpfnPageSetupHook = (LPPAGESETUPHOOK)PageSetupHook;
psd.hInstance = hInstance;
see also [Customizing the Page Setup Dialog Box^]
|
|
|
|
|
Thank you so much Rajkumar,
First of all, to respond to your comment:
"First of all, obviously, if the margins are overbound it messes up, that is known to the user, do you need to correct it?"
I couldn't agree more. It's another completely ridiculous example user madness. Unfortunately, my inclination to tell the user not to set stupid values has been overruled in this case, so here I am.
My position is that the page setup dialog box is launched from IE. Therefore, I can either subclass IE's window or I can create my own one and replace the existing dialog box.
Is there any way of applying the approach you showed me to an existing Page Setup dialog box owned by IE. I’m working from an ActiveX control running in IE?
Many thanks
Cheers
Tom
Philosophy: The art of never getting beyond the concept of life.
Religion: Morality taking credit for the work of luck.
modified on Friday, January 16, 2009 5:33 AM
|
|
|
|
|
I am having a problem with FindFirstFile, I am writing for WM5 with Visual Studio 2008 90 day trial.
Here is a chunk of code:
int GetTheFile(LPWSTR ddir)
{
LPWIN32_FIND_DATAW ac_file;
HANDLE fileHandle;
int ret=1;
wsprintf(ddir, TEXT("\\*.*"));
fileHandle = FindFirstFile(ddir, ac_file);
if (fileHandle != INVALID_HANDLE_VALUE)
After the FindFirstFile executes, ac_file is unchanged (all 0s),
fileHandle is 0xffffffff (-1 which is invalid handle),
I have tried several different things for ddir ("\\", "\\*.*", "\\Windows",...).
Any ideas?
Thanks
|
|
|
|
|
There are several problems with your code:
This is a pointer to a WIN32_FIND_DATAW struct in which you never initialize and point to a valid location.
LPWIN32_FIND_DATAW ac_file;
It would be better to be more precise about what drive you wish to access such as "C:\\*.*"
wsprintf(ddir, TEXT("\\*.*"));
See if this works for you:
WIN32_FIND_DATAW ac_file = {0};
HANDLE fileHandle =0;
wsprintf(ddir, TEXT("C:\\*.*"));
fileHandle = FindFirstFile(ddir, &ac_file);
if (fileHandle != INVALID_HANDLE_VALUE)
{
}
Best Wishes,
-David Delaune
|
|
|
|
|
I guess I didn't notice that LPWIN32_FIND_DATAW is just a pointer. I was getting a warning that I looked at and just thought "of course its not initialized, it will get a value from FindFirstFile".
So, I'll change that!
This is for a Window Mobile device, so there is no C: drive, it is just \\. Then if you want a memory card, you would enter \\<<i>name of card> like mine is \\SD Card.
I was searching for a file in a particular directory, but the file can have some parts slightly different, here is what I got working to find my file:
int GetTheFile(LPWSTR lpszDir)
{
LPWIN32_FIND_DATAW ac_file;
_WIN32_FIND_DATAW the_dir[MAX_PATH];
HANDLE fileHandle;
int ret=1;
ac_file = the_dir;
wsprintf(lpszDir, TEXT("\\My Documents\\first*.txt"));
fileHandle = FindFirstFileW(lpszDir, ac_file);
if (fileHandle != INVALID_HANDLE_VALUE)
For some reason I could not get the types to work correctly for making ac_file like you suggested, but I got it to work like this, and I can tinker with it now.
This will look for a file in \My Documents named first<something>.txt, like \My Document\first-1209.txt
Thanks for helping me figure this out Dave .
Ken
|
|
|
|
|
Hello everybody,
I have a question once again.
The program I wrote is connected to a Microsoft Access Database, so far this all works fine. My problem is, that I want to write a function that can control whether a specific table is existing in the database and if not the table gets created automatically.
Is there a way to do this with MFC based C++ code?
Greetings
|
|
|
|
|
Member 3554668 wrote: ...the table gets created automatically.
Use CDatabase::ExecuteSQL("CREATE TABLE...") .
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I want to know how windows loader loads the executables and what are the checks are perfomed by loader,
can anyone tell me where can i find the good article about this.
|
|
|
|
|
|
|
Hi all,
i have SDI type application, i m split it in i row and 2 columns.initially its have size that is i given.
but with help of mouse i m resizing it.
i want to prevent resizing spiltted view.
i want fix the width for both view that is initially i have already mentioned.
please tell me how can i do this.
i waiting for your valuable suggestion and answers.
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Check this[^]
I hope it helps..
Regards,
Sandip.
|
|
|
|
|
Thanks its done
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Hi, if it wouldn't be a great trouble could anyone direct/suggest me to an article of how to add an navigation pane positioned on the left side like an Outlook 2003. I need to use it as a shortcut bar.
I would switch the views on the right side depending on user selection.
Thanks in advance!
Here at CP I found something similar ("OutlookBar: A Simplified Outlook Style Sidebar Control" ) but for .Net, I need to use it with VC6 MFC.
|
|
|
|
|