|
Line 1120 of wingdi.h is
ASSERT(m_hObject == NULL); That means you are trying to load a second bitmap into a CBitmap object. You have to detach and delete the existing image before you can load a new one.
DeleteObject(MyBitmap.Detach());
MyBitmap.LoadBitmap(IDB_BITMAP);
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
ok, that was the point!
Thank you,
R.
|
|
|
|
|
Everybody knows the Microsoft forms 2.0 image control. I'm getting nuts with this.
I need to set the image file dynamically...but look at this.
m_imagecontrol.SetPicture(LPDISPATCH newValue);
I have a file dialog to browse the image, the question is:
how can I set the CFileDialog.GetFilename() in m_imagecontrol.SetPicture(LPDISPATCH newValue);
CFileDialog.GetFilename() is a CString, if there's a function to do this, please tell me before I kill myself.
thanks in advance pals
|
|
|
|
|
Try to look for IPicture usage. I think the LPDISPATCH param is a IPicture interface.
(rough guess)
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
I'm attempting to add a gradient background to my applications main menu bar
to match what I've done to the toolbars. I've got as far as creating a
pattern brush from a bitmap and setting it as the menus background using
SetMenuInfo() but it is not being rendered correctly. The colour should go
from dark at the top to light at the bottom but what I've ended up with is
the darker half at the bottom going from dark to light and the lighter half
at the top going from dark to light. Its as if the origin for the brush has
negative coordinates. Can anybody suggest how to correct the origin of the
brush?
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
Hi 2 all,
It is nice to be a member of this good site.Its veryh good site because its help in solvin out the queries and the problem faced by us.So know i should discuss my problem with u guys.
As i m a student of Undergrad and got a project in VC++.Our peoject is about multiLingual Translator.The basic objective is to take an input from the user and then translate it to someother language.So this is only done by Unicode. Since i donot have any exposure to Unicode so i want ur help.How should this be carried out .I dont know how to store Unicode in Database ?
So anybody who knows this solution please contace me on my Yahoo id i.e luckylaeeq4u@yahoo.com. Thanx for reading my problem . Hope some positive response from you Guys.
Bye and Take Care.
Laeeq Ahmad.
Pakistan
|
|
|
|
|
I want to do something like this, however wsprintf throws a compiler error. Is there another format function that I should use instead to do this?
BSTR path = NULL;
int num = 1;
path = SysAllocString(L"//errors/error[@id='%i']");
wsprintf(path, num);
- Nick Parker My Blog | My Articles
|
|
|
|
|
int wsprintf( LPTSTR lpOut,
LPCTSTR lpFmt,
...
);
Nick Parker wrote:
BSTR path = NULL;
BSTR != LPCTSTR (wrong type)
int num = 1;
wsprintf(_T("//errors/error[@id='%i']");, num);
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
palbano wrote:
BSTR != LPCTSTR (wrong type)
I realize that. I need to use a BSTR for the rest of what I am working on. Any other suggestions?
- Nick Parker My Blog | My Articles
|
|
|
|
|
Do all formatting using LPTSTRs, then use the T2BSTR conversion macro to get your BSTR type.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Ummm, there is a problem ...
Aside from the BSTR != wchar_t*, what do you expect wsprintf to do ?
I mean it's used to take a format string (path) and create a result - you haven't specified a result string. Are you expecting it to modify path in place (it won't even with correct types) ?
From MSDN :
typedef OLECHAR * BSTR;
These strings are zero-terminated, and in most cases they can be treated just like OLECHAR* strings. However, you can query a BSTR for its length rather than scan it, so it can contain embedded null characters. The length is stored as a 32-bit integer at the memory location preceding the data in the string.
The 32-bit is placed before the BSTR value so you don't need to worry about it, just cast the BSTR to a wchar_t*.
e.g. (without error checking)
wchar_t res[500];
BSTR path = NULL;
int num = 1;
path = SysAllocString(L"//errors/error[@id='%i']");
wsprintf(res, (wchar_t*)path, num);
...cmk
Save the whales - collect the whole set
|
|
|
|
|
You're misusing the BSTR . wsprintf() prints into a TCHAR array, but a BSTR is not an array.
BSTR path = NULL;
CString s;
int num = 1;
s.Format ( _T("//errors/error[@id='%i']"), num );
path = s.AllocSysString(); If you can't/don't want to use CString , alloc a TCHAR buffer instead and make sure it's big enough, then use the T2BSTR conversion macro to convert it to a BSTR .
Check out this article[^] if you need more details on converting between string types.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true.
|
|
|
|
|
I am working on a SDI project that calls a function SetModifiedFlag(), in my document file, if any value in my document file changes. That function is not part of my projects document file but seems to be a call to a function that exists in CDocument...(CDocument::SetModifiedFlag()). Can someone tell me what this function is? The function contains a boolean value, bModified. How can I access this value for reading, and resettng. Is this a typical way to test to see if any of your doc values have changed, etc. I am just not familiar with this and someone else developed this piece of code.
Thank You.
Jerry
|
|
|
|
|
jerry1211a wrote:
How can I access this value for reading, and resettng.
CDocument::IsModified()
CDocument::SetModifiedFlag()
jerry1211a wrote:
Is this a typical
Yes
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
In a straighforward MFC implementation, you can call SetModified() and the variable you mention is set to a 'true' value indicating data has changed. The framework would use that, or you would, when the user 'closes' your application and you would ordinarily pop up a warning that the document has changed, and ask user if he wants to save it before exiting your program. In an SDI instance, I think you would do the same thing on File|New or File|Open if the data had changed, so user does not lose data changes prior to loading a new document. When the document is saved, then the modified flag is reset to a 'false' value.
|
|
|
|
|
Hey Guys
Last Week i sat up a new system. Unfortunatly I've lost my the serial. But i've still installed it on the old PC. Any idea how i can get it from there ?
Please Help
|
|
|
|
|
Help->About
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Hi All,
Now that MS VCToolkit (compiler and libraries from VC++ 7.x) is available as a free download from Microsoft, a natural question would be - is it possible at all to use it with DevStudio 6? It would be nice to be able to use the build environment... How about debug info compatibility and command line options compatibility? Did anybody try?
thanks!
|
|
|
|
|
yurig wrote:
is it possible at all to use it with DevStudio 6?
Yes. Just set the paths to the new compiler before the paths to the VC6 compiler in the Executables section of the Directories tab in the Options.
yurig wrote:
How about debug info compatibility and command line options compatibility?
The command line is compatible, so no problems there. Unfortunately, the VC6 debugger can't understand the VC7 debugging information, so you won't be able to debug any apps generated with it under VC6 - you'll need to use the new debugging tools.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Thanks Ryan! I was able to compile my project, and this is basically all I need at this point - just make sure it will compile.
Yuri
|
|
|
|
|
MFC.
I do a skinning for a winapp written in mfc.
I have to change totally the bkcolor
apearence for all ui in a custom color.
I superclassed all controls and works fine except:
Tab controls 3d borders shadwows,
Toolbar separators,
Static frames and 3D edit controls shadows which are still
system color.
ANy Ideea.
P.S
Just Dont tell me I have to handle them on WM_PAINT
and redraw on top another rect.
|
|
|
|
|
Handle WM_NCPAINT
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Hello,
I downloaded JBSocketServer1.zip and tried to compile it, however I got the following errors coming from mswsock.h and winsock2.h
Would you know why?
Thanks in advance.
Eugene
C:\MSDev\VC98\INCLUDE\mswsock.h(69) : error C2065: 'SOCKET' : undeclared identifier
C:\MSDev\VC98\INCLUDE\mswsock.h(69) : error C2146: syntax error : missing ')' before identifier 's'
C:\MSDev\VC98\INCLUDE\mswsock.h(69) : warning C4229: anachronism used : modifiers on data are ignored
C:\MSDev\VC98\INCLUDE\mswsock.h(73) : error C2059: syntax error : ')'
C:\MSDev\VC98\INCLUDE\mswsock.h(89) : error C2146: syntax error : missing ')' before identifier 'hSocket'
C:\MSDev\VC98\INCLUDE\mswsock.h(89) : warning C4229: anachronism used : modifiers on data are ignored
C:\MSDev\VC98\INCLUDE\mswsock.h(96) : error C2059: syntax error : ')'
C:\MSDev\VC98\INCLUDE\mswsock.h(101) : error C2146: syntax error : missing ')' before identifier 'sListenSocket'
C:\MSDev\VC98\INCLUDE\mswsock.h(101) : warning C4229: anachronism used : modifiers on data are ignored
C:\MSDev\VC98\INCLUDE\mswsock.h(109) : error C2059: syntax error : ')'
C:\MSDev\VC98\INCLUDE\mswsock.h(131) : error C2146: syntax error : missing ')' before identifier 'hSocket'
C:\MSDev\VC98\INCLUDE\mswsock.h(131) : error C2165: 'left-side modifier' : cannot modify pointers to data
C:\MSDev\VC98\INCLUDE\mswsock.h(131) : error C2071: 'LPFN_TRANSMITFILE' : illegal storage class
C:\MSDev\VC98\INCLUDE\mswsock.h(138) : error C2059: syntax error : ')'
C:\MSDev\VC98\INCLUDE\mswsock.h(146) : error C2146: syntax error : missing ')' before identifier 'sListenSocket'
C:\MSDev\VC98\INCLUDE\mswsock.h(146) : error C2165: 'left-side modifier' : cannot modify pointers to data
C:\MSDev\VC98\INCLUDE\mswsock.h(146) : error C2071: 'LPFN_ACCEPTEX' : illegal storage class
C:\MSDev\VC98\INCLUDE\mswsock.h(154) : error C2059: syntax error : ')'
C:\MSDev\VC98\INCLUDE\winsock2.h(95) : error C2378: 'SOCKET' : redefinition; symbol cannot be overloaded with a typedef
C:\MSDev\VC98\INCLUDE\winsock2.h(112) : error C2146: syntax error : missing ';' before identifier 'fd_array'
C:\MSDev\VC98\INCLUDE\winsock2.h(112) : error C2501: 'SOCKET' : missing storage-class or type specifiers
C:\MSDev\VC98\INCLUDE\winsock2.h(112) : error C2501: 'fd_array' : missing storage-class or type specifiers
C:\MSDev\VC98\INCLUDE\winsock2.h(115) : error C2059: syntax error : ')'
|
|
|
|
|
Try including winsock2 before mswsock
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
No including winsock2 before mswsock did not help...
Eugene
|
|
|
|