|
All,
I am trying to compile some code that uses the FILETIME structure. When I try and compile it I get the following error message:
c:\Documents and Settings\Me\My Documents\my projects\CPP Projects\First Project\Hello World Proj\Form1.h(27) : error C2872: 'FILETIME' : ambiguous symbol
could be 'C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinDef.h(354) : _FILETIME FILETIME'
or 'stdafx.cpp(0) : System::Runtime::InteropServices::FILETIME'
It appears that there are two different declarations for FILETIME. When you search the MSDN Library for just "FILETIME" it tells you to just include windows.h. If you search the MSDN Library for "about FILETIME structure" it says that it is located in the namespace system.runtime.interopservices. I should mention that I have both an include of windows.h and a line for:
using namespace System::Runtime::InteropServices
If I comment out the using namespace line in order to fix the error I get a profusion of different errors because I use message boxes and apparently they need that namespace definition.
c:\Documents and Settings\me\My Documents\my projects\CPP Projects\First Project\Hello World Proj\Form1.h(208) : error C2653: 'MessageBoxA' : is not a class or namespace name
Thanks in advance for any ideas,
Robert
|
|
|
|
|
Here's two options:
1) Qualify FILETIME as being in the global namespace as: ::FILETIME, so that the compiler knows you are not refering to the one in System::Runtime::InteropServices.
2) Instead of importing the entire InteropServices namespace, either qualify them explicitly, or just include the classes that you actually need (e.g. using System::Runtime::InteropServices::Blah).
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
I want to change a toolbar bitmap image Inbox to a different bitmap (or a bitmap with a very different color background) when there are messages in the Inbox. Or some way to give the user an alert that there are new messages in the Inbox. Can this be done?
Elizabeth
|
|
|
|
|
One quick method would be to have two cpies of the same toolbar in your resources which have the same buttons, but one has a different image. When you need to switch bitmaps, you just call pToolbar->LoadToolbar() with the correct resource id for the correct images you want.
I do somehing similar in an app of mine to switch between small/large icons and it works fine.
Roger Allen
Sonork 100.10016
Death come early, death come late,
It takes us all, there is no reason.
For every purpose under heaven,
To each a turn, to each a season.
A time to weep and a time to sigh,
A time to laugh and a time to cry,
A time to be born and a time to die.
Dust to dust and ashes to ashes,
And so I end my song.
|
|
|
|
|
I tried out your method. However, the toolbar flashes whenever the mouse is over it. I had LoadToolBar() at ON_UPDATE_COMMAND_UI(ID_INBOX, OnUpdateInbox). The flashing is very annoying.
Elizabeth
|
|
|
|
|
It sounds like you just need to add a small amount of extra processing that only calls LoadToolbar() when a change in the button state is required. That should remove the flashing in the ON_UPADTE() handler.
Roger Allen - Sonork 100.10016
If your dead and reading this, then you have no life!
|
|
|
|
|
I added some lines to set state of the toolbar, but once it gets out of ON_UPDATE_COMMAND_UI, the state is reset. What I am trying to do is to set the toolbar button ID_INBOX to TBSTATE_PRESSED when there is new mail and TBSTATE_ENABLED when there is no new mail. But the toolbar keeps flashing when I move the mouse over it. Here is some code:
if (pDoc->NewMail())
{
if (m_wndToolBarCtrl.GetState(ID_INBOX) != TBSTATE_PRESSED)
{
m_wndToolBar.LoadToolBar(IDR_MAINFRAME_NEWMAIL);
m_wndToolBar.GetToolBarCtrl().SetState(ID_INBOX, TBSTATE_PRESSED);
}
}
else
{
if (m_wndToolBar.GetToolBarCtrl().GetState(ID_INBOX) != TBSTATE_ENABLED)
{
m_wndToolBar.LoadToolBar(IDR_MAINFRAME);
m_wndToolBar.GetToolBarCtrl().SetState(ID_INBOX, TBSTATE_ENABLED);
}
}
Elizabeth
|
|
|
|
|
hi, im tryin to find some simple code for a water effect in opengl. basically something i can use for an ocean effect. any ideas?
bik
|
|
|
|
|
I downloaded GLUT a week ago, and it has a pretty cool underwater demo which you might be able to modify or use directly.
Glut for win32[^]
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Hi,
I think you can find more information in this forum...
http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/010669.html[^]
If you read the discussion, you will find out that there is no such thing as simple water effect (if it is simple it is not a water effect). There are also a couple of good article links in the above discussion.
Good Luck...
Orhun Birsoy
|
|
|
|
|
I Apple Mac OS file system.. the files do not have extensions.. but when you open the file, it open with the right creator application. For example,
you create a document using MS Word application and save it without the extension. and close it and you reopen the file again, it opens with MS Word without prompting (like Window OS) openWith dialog.
From what I understanding, Mac OS uses file header or something that tells the type of the file and OS use it, get the right application to open with to open the file
I tried to use the example from Microsoft.com http://msdn.microsoft.com/library/default.asp?url=/library/en-us/stg/stg/enumall_sample.asp
but only works for Word and Excel files.. others it just dies
Can we do same think like it using c++ or vb for Window OS???
|
|
|
|
|
The given link just works on Microsoft Office files - it looks for values defined in the Microsoft standard, and so will not work on anything else. From memory, the Mac has some meta-information for each file which it uses to determine what to open it with. However, I also recall reading that Apple have deprecated this feature (possibly in favour of file extensions).
If you want to have automatic filetype detection in Windows then you'll have to use file extensions - I dont see this as a problem, and it makes identifying them for a human easier as well. If you want automatic detection within one of your own programs then you can implement your own meta-information, and put a header onto your files, or have an index describing what the file is.
|
|
|
|
|
so what you are saying the given link is just works for Microsoft Office files.. so how come only excel and word files could read but not access and powerpoint files..
<br />
If you want to have automatic filetype detection in Windows then you'll have to use file extensions - I dont see this as a problem, <br />
yes there is a problem in detecting file type base on the file extensions..
because some of the files do not have file extensions and human have to figure it out by trying to open the file with several application to see whether if the file is readable with that application or this application.
and it makes identifying them for a human easier as well.
so it is not easier for human.
it takes time to open on file without the extensions..if i can write the function that could determine the file type, not base on extension, I can just open/print the right application (programmatically)
sometime the file extension is .doc but the file was created with Adobe Acrobat because someone has changed the file extension.
so finding out the file type depending on the file extension is not really good.
I just wondering if MAC can tell the file type of the file without file extension, is there any methods or ways to do the same as MAC
|
|
|
|
|
I have a function show where I have the
following statements:
cout<
|
|
|
|
|
Try to send the fileout as an argument to your function
void parint (offstream &fileout,char *string)
{
fileout<
|
|
|
|
|
Also, you should consider writing an operator << for your class ( I presume all this data is in a class ), then you can just stream the whole lot to any stream type you like, in one go.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I am just learning C++ can you give me an example how to do this?
|
|
|
|
|
I've written articles here on the CP site on how to do this, so search the site for iostream and look for my name as author.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I am googling around "what is a callback function" and sort of have gotten the general idea. I've been doing some MFC for a year or so, but havent yet seen it used. I'd appreciate some links to more info on what these are exactly and when they are used since obviously I havent run into a situation where I needed one....
Thanks,
ns
|
|
|
|
|
Callback functions are used in Win32 APIs (eg: during printing). MFC provides more formal callbacks in the form of handlers that you can override, eg: CWnd::OnSize() which is called by the framework when the size of the window has changed.
In OO code, callbacks are usually implemented using the Observer pattern, where your custom code (the callback) is executed when an event of interest occurs.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Ah! That I can relate to. I hadnt made the connection....
Day off tomorrow!
|
|
|
|
|
Enumeration (e.g., EnumFontFamilies() ) functions make use of callback functions.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Thanks!
The five birds riddle in your sig: is the answer "none" because the ones that didnt fly off got shot or something? Just curious.
Thanks,
ns
|
|
|
|
|
How to change a cell proporties(color for example) into excel file with c++? I use odbc for write into the file but i search to change cell color. I'm use MFC(sorry for my poor english).
Ths Jérôme
|
|
|
|
|
you cannot change properties, appearence of an Excel sheet by using ODBC. Office automation is what you will need.
If you decide to switch to Office automation than you will have all the formatting capabilities that you have when manually editing an Excel sheet, and of course you can also feed your sheet with data as well.
Search MSDN for samples.
Bunburry
|
|
|
|