|
I told you that m_MainMenu is your menu. You will have to replace it with your variable.
If it's the apps menu then you have to do something like this
m_MainMenu = GetMenu();
-----
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
|
|
|
|
|
|
Use the ON_UPDATE_COMMAND_UI message if possible.
...
ON_UPDATE_COMMAND_UI(IDM_YOUR_MENU_ITEM, OnUpdateYourMenuItem)
...
void CMainFrm::OnUpdateYourMenuItem(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck( IsMenuItemCheck() );
}
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
I am reading from 2 datafiles with three entries:
File 1:
--------
abc
def
ghi
--------
file 2: has an extra blank line after ghi
---------
abc
def
ghi
--------
If I have an ifstream object 'fin' and I do
char val;
while (!fin.eof())
{
fin >> val;
cout << val;
}
For file 1 I get the output as
abc
def
ghi
as expected.
But for file 2 I get
abc
def
ghi
ghi
1.Why is this?
2.How can I prevent it from processing any extra blank lines?
thanks,
ns
|
|
|
|
|
Using getline() might help.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
use cin.get()....or create cstyle file operations...
create FILE*....
use fgetc(fp)....
|
|
|
|
|
Right, but you should probably direct this towards the OP, otherwise your suggestion will possibly go unseen.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi
I have created a property sheet and some property pages.
My property page is user details and to avoid one big dialog I used property pages to split it up so I have address on one page contact info on another page and so on.
Can my pages access the sheet in any way?
I want my sheet to provide functions to save and load my user details so that changes to any of my pages calls the functions provided by the sheet. This is much easier than saving and loading for each page. I could have a function called load() in my property sheet which I could then call from any property page.
Now I have one file to store all my user details in but one easy way is to have a separate file for each property page but that means having several files where I only had one before.
|
|
|
|
|
Anonymous wrote:
Can my pages access the sheet in any way?
* Try:
CMySheet *pSheet = ((CMySheet *) GetParent());
-OR-
CMySheet *pSheet = ((CMySheet *) GetOwner());
* And for your dialog in which you have the sheet, you can have:
CMyDialog *pDialog = ((CMyDialog *) GetParentOwner());
The reason I have answered the second one is if you want to access your sheet through your dialog, as pDialog->pMySheet , this could help!
- Nirav
* Don't wish it was easier, wish you were better! *
|
|
|
|
|
Assuming your property sheet has each page as a member, you should be able to pass data to each page on initialisation and read data back from each page before your property page closes using simple member functions defined for each page.
If in your case you have a user object, it can handle a single file for you which is how it should be done of course, and your property sheet can call the user object's load() function at initialisation, you then pass a pointer to the user object to each of your pages and they can read and modify data using the member functions the user object provides or you could just pass them the values of the user objects. Before your property sheet closes, it can then call the user object's save() function if any modifications have been made.
e.g.:
MyPropSheet.h:
CMyPropPage1 m_MyPropPage1
CMyPropPage2 m_MyPropPage2
MyPropSheet.cpp:
CMyUser myUser;
myUser.Load();
m_MyPropPage1.setUser(&myUser)
m_MyPropPage2.setUser(&myUser)
AddPage(&m_MyPropPage1);
AddPage(&m_MyPropPage2);
"The folly of man is that he dreams of what he can never achieve rather than dream of what he can."
"If you think education is expensive, try ignorance."
|
|
|
|
|
How can I determine if a print job was not printed. (ie the printer was off or out of paper). Currently if the printer is off the usual mechanism put the job in the queue and the print manager askes the retry of cancel question. As this is for a stock control label, I need to know if it printed OK.
I do not need a complete solution, just a starting point as this is a new area for me. I do not have to much of a clue where to start looking.
The openprinter
StartDocPrinter
StartPagePrinter
WritePrinter
EndPagePrinter
EndDocPrinter
ClosePrinter
etc functions all gibe a good return code too.
Any pinters welcome
|
|
|
|
|
You need to examine the printer status functions.
You need to know which printer you sent your print jobs to,
and then get the printer status and the printer's jobs' status.
I have been puling my hair out trying to figure out how to detect the printer has some other problem than just 'offline', since most printer drivers do not update the printer status data with anything but the offline bit.
One thing I do, is to watch the printer's job count. If it does not decrease over time, then something is wrong with the printer, like it is sitting there out of paper.
If you are REALLY hard core, you can write something called a 'print monitor', and it can get between Windows and the printer drvier, and this can potentially detect that the printer is off or out of paper or some other types of errors.
Look at the functions EnumJobs and GetJob
|
|
|
|
|
Was refered to this url on experts-exchange. might help you save some of your hair.
http://support.microsoft.com/default.aspx?scid=kb;EN-US;160129
tcss
|
|
|
|
|
Hi guys,
What is the equivalent in GDI+ of the MFC statement?
CBitmap bmp(<resourceid>);
I would like to load a resource bitmap in GDI+.
Best regards.
|
|
|
|
|
Try this,
http://tinyurl.com/3gn88
|
|
|
|
|
that's GDI+ doc... it shows how to load an Icon or an image from a file.
I would like to load a bitmap from a resource (already bind with the program).
|
|
|
|
|
Hi!
I have a DLL with a JPEG ressource and the main App,
that shows this.
here ist the Code from the DLL:
BYTE* GetLogo(int &nSize) {
DWORD dw;
HRSRC hRes = FindResource(theApp.m_hInstance,_T("IDR_LOGO"),_T("Images"));
dw = GetLastError();
HGLOBAL hg=LoadResource(theApp.m_hInstance,hRes);
LPVOID lpRes=LockResource(hg);
nSize = SizeofResource(theApp.m_hInstance,hRes);
dw = GetLastError();
return (BYTE*)lpRes;
}
and here ist the code from the APP:
void CWBLogoWnd::SetImage(BYTE*pBuffer, int nSize) {
IStream *pStream;
HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE, nSize);
if (hGlobal)
{
void* pData = GlobalLock(hGlobal);
if (pData)
memcpy(pData, pBuffer, nSize);
GlobalUnlock(hGlobal);
CreateStreamOnHGlobal(hGlobal, TRUE, &pStream);
}
#ifdef _DEBUG
#undef new
m_pImage = new Image(pStream,true);
#define new DEBUG_NEW
#else
m_pImage = new Image(pStream,true);
#endif
}
|
|
|
|
|
ok it works
Thanks a lot!
|
|
|
|
|
I have .NET installed on my pc. Unfortunately its not on a single dvd but on 7 cds. So having been through this process several times before , this time is there an easy way to copy a .NET installation onto another machine so I can avoid the 7 cd scenario.
Basically apart from dragging the relevant folders overs is there anything else. I would copy over the reg keys as well. ANy hidden traps. Anyone actually done this? Is it possible to create a dvd on the .NET install from a vanilla install of the 7 cds. Sort of like windows slipstreaming service peaks. Sorry to be a little off topic. At least I mentioned .NET!
Thanks,
|
|
|
|
|
anonymous wrote:
At least I mentioned
you are waaaaaaaaaaaaaaaaaay of topic , not just the forum but also what you are trying to do,
One cannot copy the folder from one pc to another and you have .net installed.
Sure there is a way if you can mirror the hardrive, but then not sure that will work too.
plus you will lose all data in the destination hardrive.
Simple solution, install the .net in the new pc using the 7 cds.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
surely someone has done this. I cant be the first one to try. It worked under dos.
ANyway surely its just the registry that might make it hard. Maaaybe .NET puts stuff in other places. Do you know how painfull it is to install the .NET with 7 cds. Talk about wasting an afternoon.
|
|
|
|
|
Anonymous wrote:
It worked under dos
are we talking about dos or windows? both are different os and works different too.
Anonymous wrote:
surely someone has done this
note sure.
Anonymous wrote:
ANyway surely its just the registry that might make it hard. Maaaybe .NET puts stuff in other places
it puts hundreds of registry entries.
Anonymous wrote:
Do you know how painfull it is to install the .NET with 7 cds. Talk about wasting an afternoon
with your method of copying will take humm may be all week. be smart put the CD1 inside the tray and click on setup.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
well the visual studio .NET folder is 1.64 GB and the one on c:\ drive is 7.95 MB.
( I have a installation not in the default place)
Creating a dvd 80% full takes about 30 mins so I dont think the above copy will take too long.
mmm regedit has an export branch option. That export/import shouldn't take long.
THe question was not about whether its hard but if its possible? If someone has done it.
Thanks for your suggestion though its just that I have installed .NET with 7 cds too many times
|
|
|
|
|
Anonymous wrote:
Do you know how painfull it is to install the .NET with 7 cds
Do you know how painful it is to use .NET if it is not installed correctly?
With all the time you are wasting trying to figure out a different way to install, you may as well have been installing.
Chris Meech
We're more like a hobbiest in a Home Depot drooling at all the shiny power tools, rather than a craftsman that makes the chair to an exacting level of comfort by measuring the customer's butt. Marc Clifton
VB is like a toolbox, in the hands of a craftsman, you can end up with some amazing stuff, but without the skills to use it right you end up with Homer Simpson's attempt at building a barbeque or his attempt at a Spice rack. Michael P. Butler
|
|
|
|
|
>Do you know how painful it is to use .NET if it is not installed correctly?
yes
>With all the time you are wasting trying to figure out a different way to install, you >may as well have been installing.
True,
but the saving is the next time I have to do it, Or for the other people that don't want to use 7 cd's. Thats why we spend a lot of time getting an adt correct so that we can package it into a dll and be done with it.
I already have .NET on my main machine is not like its mission critcal to get it done.
Thats why I can afford to think about an easier way to apply the update.
I might try it and get back to you.
|
|
|
|