|
Please narrow this down to only that which is relevant. Everything else is just undue noise.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
I am trying to load a cursor globally using cursors made in VC++ 6.0. However, the loadcursor function is either returning a HCURSOR of zero, or it is returning something completely different from what is in the visual studios resources.
I'm really trying to load a blank cursor (I have a touch screen monitor that has a program that I have no control over loading on it, in which I would still like to hide the mouse pointer). Here's the code below.
Returns a handle of 0:
HCURSOR blankCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_CURSOR1)) ;
HCURSOR theCursor = CopyCursor(blankCursor) ;
SetSystemCursor(theCursor, OCR_NORMAL) ;
Loads a random cursor:
HCURSOR blankCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_POINTER_COPY)) ;
HCURSOR theCursor = CopyCursor(blankCursor) ;
SetSystemCursor(theCursor, OCR_NORMAL) ;
Not sure if it's just some setting I'm missing or what. The two cursors don't have any special settings in their properties, why would one return nothing and the other return something random? Loading the default windows pointers works fine.
|
|
|
|
|
pjdriverdude wrote: However, the loadcursor function is either returning a HCURSOR of zero...
Which means you should be calling GetLastError() to find out why.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hmm interesting:
ERROR_RESOURCE_TYPE_NOT_FOUND - The specified resource type cannot be found in the image file.
|
|
|
|
|
Well it turns out that there's a blank.cur file in the windows\cursor folder. I just used the following and it loaded up just fine.
HCURSOR blankCursor = LoadCursorFromFile("C:\\WINDOWS\\Cursors\\blank.cur") ;
::SetSystemCursor(blankCursor, OCR_NORMAL) ;
|
|
|
|
|
hello guys...i am writing small program for TAPI app. When I try to compile this I get this error in tapi.h header file
fatal error c1020: unexpected #endif
I looked like my code has nothing to do with it so im gonna paste the very last portion in tapi.h and there, very last line #endif is my problem.
#define TAPIERROR_FORMATMESSAGE(__ErrCode__) \
\
( ( (__ErrCode__) > 0xFFFF0000 ) ? \
\
( (__ErrCode__) & 0x0000FFFF ) : \
\
( ( (__ErrCode__) & 0x10000000 ) ? \
\
( (__ErrCode__) - 0x90000000 + 0xF000 ) : \
\
( (__ErrCode__) - 0x80000000 + 0xE000 ) ) )
#ifdef __cplusplus
}
#endif /* __cplusplus */
#pragma pack()
#endif // TAPI_H
modified on Thursday, September 16, 2010 1:14 AM
|
|
|
|
|
Have you see this? What is contained in the stdafx.h file (that is perpetuating all the way into tapi.h )? The rest of the code you've shown really has nothing to do with the error.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
your #if and #endif preprocessor statements are unbalanced, in particular there seems to be an #endif without a matching #if. Although the balance needs to be maintained only at the top level, it is good practice to also keep things balanced in each and every file.
If your compiler complains about tapi.h then that is where you must check your #if and #endifs.
|
|
|
|
|
It is complaining about tapi.h, how would I know that which #if is missing in tapi.h heafer file??
|
|
|
|
|
overloaded Name wrote: how would I know that which #if is missing in tapi.h heafer file??
by reading the content of said file, balancing each #if (or #ifdef or #ifndef) with its #endif, until you find an orphaned #endif. (That is also how the compiler does it). Chances are it is near the end of the file, but that is not a given.
|
|
|
|
|
There's likely nothing wrong with tapi.h . Check your project's stdafx.h file.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Perhaps if you showed the full message including the module name and line number someone could have a guess at what is wrong.
It's time for a new signature.
|
|
|
|
|
File: tapi.h...............
Line: 5281
|
|
|
|
|
overloaded Name wrote: File: tapi.h...............
Line: 5281
OK, so now go and look at that file - there should be a #endif statement on that line, so you can scan backwards to find out why it does not have an opening #if . However, as someone else has suggested, it is more likely something external to that header file that is causing the problem. Check your own source files to make sure you have not coded a spurious #if statement somewhere.
It's time for a new signature.
|
|
|
|
|
Unless you mistakenly modified tapi.h that is NOT the problem.
The message means that, while compiling a Cpp file (.h don't exist for the compiler, they are pasted in by the preprocessor in a previous compilation stage) and #endif ending nothing had been found.
Jut check if you didn't place an extra #endif in a file you include before including <tapi.h> in the Cpp file that gives the error.
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
Emilio Garavaglia wrote: Unless you mistakenly modified tapi.h ......
well i dont remember doing so but lets suppose I did that, what is the solution??
|
|
|
|
|
We come to a point where we have a lot of hard-coded string in our application (because laziness, design issues, release-scheduling, ...).
Most of our string are in the resources (string tables) and are used in the UI part of the application, but some of them are in the non-UI part (libraries) that does not have a direct access to the resources, and we don't want to have a dependence on the resources.
Is there a best-practice way to deal with large quantity of string ?
Simple header file with <code>const char*</code> ?
const char* myString = "my string";
or with <code>#define</code> ? Easy but not user friendly for potential localization.
#define myString "my string"
or an XML file with something like that (rough idea)?
<string ID="myString">
my string
</string&g
Or stick with the main resource file and string tables ? or one new resource for each libraries and include them in the main application resource ? possible issues with ID conflicts ?
Thanks.
Max.
Watched code never compiles.
|
|
|
|
|
Have a look at gettext. I've used it in a couple of projects and it's worked okay. It doesn't require loads of changes to the source and it's not too bad for localisation. It also handles strings from libraries fairly well.
One big bugger is that it's a bit arcane to support unicode, but you can get over that with a bit of reading.
Cheers,
Ash
|
|
|
|
|
Aescleal wrote: Have a look at gettext.
gettext what ?
I've googled a bit on MSDN and could not find a reference, are you talking about the gnu/linux/whateverux gettext ?
Watched code never compiles.
|
|
|
|
|
That's the one - GNU gettext. It's a library and a suite of tools for managing strings in applications.
Cheers,
Ash
|
|
|
|
|
A product family could have the following resourses division :
- application level, with all libs used by an application:
one resource.h and one directory for resource DLLs
(the shared by applications libs could have a reserved ID-area
in an external header)
- that directory is the second (sub-)level:
DLLs - for each needed language
Of course, the only GUI-Strings should be placed in the resources
(which must be localized (translated ?)).
An application does set the resource handle to its needed dll,
for itself and all its libs at the run time.
A "counter question":
what role can have a non-GUI string constant in a real code ?
virtual void BeHappy() = 0;
|
|
|
|
|
Maintain Excel File for reading the strings used in application.
One Excel File for one language.
Each sheet in Excel File for each of your module or application or library.
Reading and writing from Excel File is easy with :
BasicExcel - A Class to Read and Write to Microsoft Excel - The Code Project - C++
|
|
|
|
|
use "ini" file
read string from ini file by GetPrivateProfileString method
|
|
|
|
|
This is what we used to do with DOS and 16-bit Windows.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
it store data in key value pair. and it work well in windowXP
|
|
|
|