|
Hi,
I want to put in a site links that would start my application. Something like yahoo has in the profile pages:
ymsgr:sendIM?yahoouser
I know how to make a handle that will send the call to my app using something like myapp:command?parameter but what do I have to do in my app to catch that command and get the parameter?
Thanks
-----
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
|
|
|
|
|
Hi
I would like to palce a check mark for menu item, if user clicks a menu item. I would like to do this from CMainFrm class.Can u please give me an idea?
Thanks
JP
|
|
|
|
|
You have to have a function that would execute the code when the users selects the menu item.
Let's say it's
ON_COMMAND(ID_YOURMENUITEM, TestFn)
Maybe you want to use a global variable that will tell you the state of that item.
bool testVar;
void TestFn() {
CMenu *m_MainMenu;
// let's say you have your menu in m_MainMenu
if (testVar) {
testVar = false;
m_MainMenu->GetSubMenu(1)->GetSubMenu(x)->CheckMenuItem(n, MF_BYPOSITION | MF_UNCHECKED);
} else {
testVar = true;
m_MainMenu->GetSubMenu(1)->GetSubMenu(x)->CheckMenuItem(n, MF_BYPOSITION | MF_CHECKED);
}
}
where n is the position of your item in the menu
-----
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
|
|
|
|
|
Hey
In above example, m_MainMenu is unreferenced..so that code is not working. How to attach my Mainmeu to this?
Thanks
JP
|
|
|
|
|
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.
|
|
|
|