|
What is the exact error you got? You probably need to catch file exceptions.
|
|
|
|
|
OK
This seems strange.
You said the you included afx.h
Try this please
#include <afx.h>
char* pFileName = "test.dat";
TRY
{
CFile f( pFileName, CFile::modeCreate | CFile::modeWrite );
}
CATCH( CFileException, e )
{
#ifdef _DEBUG
afxDump << "File could not be opened " << e->m_cause << "\n";
#endif
}
END_CATCH
Best Wishes and Happy Holiday's,
ez_way
|
|
|
|
|
And those compiler/linker/runtime errors are?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi,
when I delete a listbox item it seams the top index is set to 0, is this a normal behaviour? Can I switch this off or is there any good workaround?
Thanks for help, Moak
Here is a little MFC code snippet to produce the effect:
<br />
BOOL CTest1Dlg::OnInitDialog()<br />
{<br />
CDialog::OnInitDialog();<br />
<br />
for(int t=1;t<20;++t)
{<br />
CString sText;<br />
sText.Format("listbox line %d", t);<br />
m_list.AddString(sText);<br />
}<br />
m_list.SendMessage(WM_VSCROLL, SB_BOTTOM, NULL);
<br />
return TRUE;<br />
}<br />
<br />
void CTest1Dlg::OnButton1() <br />
{<br />
m_list.DeleteString(0);
<br />
}<br />
|
|
|
|
|
void CYourApp::OnDelete()
{
CString tmp;
int nCurItem = m_ctrlMainList.GetCurSel();
m_ctrlMainList.GetText(nCurItem,tmp);
if (nCurItem != LB_ERR)
m_ctrlMainList.DeleteString(nCurItem);
UpdateData(FALSE);
}
Call it and see if the abhorant behavior continues.
Best Wishes and Happy Holiday's,
ez_way
|
|
|
|
|
use code as:
int iSel=m_list.GetCurSel();
//delete
m_list.SetCurSel(iSel);
includeh10
|
|
|
|
|
doesn't work all the time, it requires a selected item.
|
|
|
|
|
includeh10 wrote:
int iSel=m_list.GetCurSel();
//delete
m_list.SetCurSel(iSel);
how about this...
int nIndex=m_list.GetTopIndex();
m_list.DeleteString(0);
m_list.SetTopIndex(nIndex);
It will work also without selection (Sorry, BaldwinMartin I didn't understand your code). Do I really have to do this... why does deleting an item changes the position, is that a known bad Win32 behaviour?
Thanks again
|
|
|
|
|
Some dialogs have new Windows XP
style - I maen buttons are not only simple
grey rectangle but they look better.
(as draw) or combo box has selection
button as blue rect and so on.
But when I am creating my dialog based
applications (in VC++ 7.1)
it still looks as Windows 98 or so on
even they run under Windows XP.
Is here any way how to turn of
this style for my application?
Thank you
Viliam
viliam
|
|
|
|
|
I assmume that what you are asking is how to enable Windows XP Visual Styles for your application, so that you dialog window is drawn in the current theme.
You will need to add a Common Controls Manifest to your application, this is a script written in XML that forces your application to use version 6.00 of the ComCtl32.dll to draw the controls and non-client areas of your windows.
This manifest can be embedded in your exe file's resources, or you can place it in the same directory as your exe file and give it the same name as your exe file with .manifest appended to the end. For example, if your exe is called MyApp.exe then you would call you manifest file MyApp.exe.manifest.
Click here[^] for further information.
Hope this helps,
Chris
|
|
|
|
|
My C++ editor is painfully slow on a large file (13 000 lines) whenever I add a new line. Does anybody know something I can turn in or off so it would be usable?
Thanks for any advice (oh apart from breaking up the file!)
|
|
|
|
|
Is there other problems with the machine (no more disk space, etc.)?
|
|
|
|
|
I am afraid not... space on hard drives and below physical memory capacity...
|
|
|
|
|
1) Are you using visual assist, or any other pluggings? See if you can turn'em off improve performance...
Another option is to delete *.ncb, *.opt, *.clw... If *.opt is corrupt vc editing will be very slow.
Brian
|
|
|
|
|
Deleted the opt and it worked! Thanks a lot! I am very grateful!
|
|
|
|
|
I have dialog based application.
And any time when I press some keyboard key
over the window it makes sound (Window sound)
Is here any way how to turn it off from program?
Thanx
Viliam
viliam
|
|
|
|
|
See if this helps any.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Thank you,
this is not exactly what I am looking for.
I didn't know this way but I cannot mute the speakers
in my application. It's already playing different audio
and problem is that I am playing audio and whan key
is pressed the key sound is mixed with my audio.
Key sound is not bothering me in time when
is nothing played - it doesn't matter in that time.
viliam
|
|
|
|
|
Hello Guys...
Thank you guys for the reply...
i have one more doubt...i wanna change the COLORREF item to RGB structure..ie i want the seperate values for R, G and B
Thanks in Advance,
Hariharan.S.N
|
|
|
|
|
GetRValue and friends...
Steve S
|
|
|
|
|
COLORREF RGB(
BYTE bRed, // red component of color
BYTE bGreen, // green component of color
BYTE bBlue // blue component of color
);
above is the structure
#define RGB(r, g ,b) ((DWORD) (((BYTE) (r) | \
((WORD) (g) << 8)) | \
(((DWORD) (BYTE) (b)) << 16)))
Above is the Macro
So COLORREF is a 24-bit RGB color.
BYTE GetBValue(
WORD rgb // 32-bit RGB value // blue
);
BYTE GetGValue(
DWORD rgb // 32-bit RGB value // green
);
BYTE GetRValue(
DWORD rgb // 32-bit RGB value // red
);
The GetRValue macro is defined as follows:
#define GetRValue(rgb) ((BYTE) (rgb))
#define GetGValue(rgb) ((BYTE) (rgb))
#define GetBValue(rgb) ((BYTE) (rgb))
long green = 128;
long red = 128;
long blue = 128;
COLORREF clr = RGB((blue + (green * 256) + (red * 255));
You may also create a structure of you own with COLORREF as a element with it.
Hope this helps.
Best Wishes and Happy Holiday's,
ez_way
|
|
|
|
|
Hi,
I have a namespace extension integrated in to the windows explorer,name space extension is a ATL COM(STA), it is creating another ATL com component (STA) (kinda tier2) This tier2 component is again creating the another STA component, now all the components are created once for the life time of the namsespace extension.
Every thing goes fine with one instance of explorer open. When the user opens another instance of the windows explorer then things goes dratically wrong, The namespace extension is able to access the second com component but the second com component fails when any method of the third component is used.
Its tested that all the pointers are valid nothing wrong with that.
I dont know how clear i am, But please try helping me out coz i am out of options.
The World is getting smaller and so are the people.
|
|
|
|
|
Concert Hall Reservation System
Objective:
To automate the manual reservation system of concert hall.
Minimum requirements
The program must be able to:
- provide information to the user of which seats are reserved and which
are vacant in a tabulated form.
- compute and record payments/reservation fees of clients.
- assign seat and ticket numbers to attendees/clients.
- must have delete, edit and add functions
- maintain at least 100 records.
hope you could help me do this project before december 10... iwould definitely appreciate your help.......... this is my only hope on passing my subject just email me at omissom2002@yahoo.com for some help... im just a 17 yr old, newbie on using C++, and i really need your help. just a freshie college so i dont have a lot of idea regarding this stuff....
JRBD
|
|
|
|
|
What type of development environment are you using? There are plenty of samples to be found, both here at CP and via google, if you enter some basic search parameters.
Can't you ask your tutor for some direction?
Debbie
Debbie
|
|
|
|
|
ei thanks for replying... well i really need your help.. i realyl don't know what to do... my professor don't want us to ask question to him. He always say,... GO and explore. well i really hve difficulty on understanding how to do this stuff... will you help me on this???? thanks a lot.... oh by the w7y, it must be done using visual C++ 6.0........
JRBD
|
|
|
|