|
Yes, I have looked. It's ok for icon resources, but fail for cur resources, who can help me, thanks
|
|
|
|
|
Explain what you mean by "fail"? It crashes, UpdateResource returns with FALSE (in this case, what does GetLastError give you?), everything seems to succeed but the executable is not updated/saved?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
Everything is ok, but the cur added is black and with wrong data attribute(size, color and so on), i don't know which go wrong, however the same code is fine for icon file
|
|
|
|
|
And you are sure the source is OK, i mean the cursor file you want to add.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
Yes, i think so, as i replace the source of one cur resource with the tools of "Res Hacker", it's ok!
|
|
|
|
|
Maybe the data gets corrupted when you load the cursor file to be passed as the pData parameter of UpdateResource[^]? The documentation also says that it has to be properly alligned, could this maybe be the cause of the problem?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
nenfa wrote: ...but fail for cur resources...
So UpdateResource() returns 0 ?
"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
|
|
|
|
|
No, it returns non-zero value, if i change to RT_ICON, it'll show, this's so strange
|
|
|
|
|
I embed a COleDocObjectItem in my CView object, when COleDocObjectItem is initialized, it
makes my CMainFrame's toolbar disappeared.
I think COleDocObjectItem::OnActivateUI causes that. I am wondering if I can override
OnActivateUI and bring back the toolbar.
TIA for your help.
|
|
|
|
|
Hi Team,
I have written my Application using MFC Doc/View architecture and I am using the Print feature of MFC Doc /View Architecture . I have written some code to print the chart using Printer .
But if I want to print using Plotter ,do I need to write different logic ,or the same code which is used to print in Printer will be applicable for the Plotter also .
I would be really grateful for the Inputs.
Regards,
Jack
|
|
|
|
|
Provided your hardware has a Windows printer driver then you should be able to use the same (or almost the same) code to draw on the screen, on a bitmap style printer (like an old laser printer) or a vector printer (like a plotter). The only difference I can remember was having to set up the pages correctly - provided you're already scaling your output to the size of the output device it shouldn't be a problem.
Cheers,
Ash
|
|
|
|
|
Thanks Ash for your valuable inputs
|
|
|
|
|
Hi!
While Debugging(Ctrl + F5) my project,all the files get compiled if change is made at one or two files. What to do to compile only the files that has changes in it?
|
|
|
|
|
Try to turn on "Enable Minimal Rebuild" in C/C++ / Code Generation section.
|
|
|
|
|
|
Turn on precompiled headers if not on already. Otherwise, are those files you edit maybe header files that are included in everything OR included in a header that is included in everything, like stdafx.h?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
It sounds like you're entering dependency hell... To avoid that check that:
- you're not modifying something in a precompiled header. As a general rule if you MUST use precompiled headers then make sure there are only system includes in there that aren't going to change
- You haven't got some global file with system wide error messages in. It's is a recipe for disaster, don't do it. The same goes for variables and vast globs of utility functions.
- remove all extraneous guff out of headers. Don't include other headers when forward declaring something will work as well
- use parameterise from above and other decoupling patterns in your code. Don't use concrete types in most of your code, program to interface classes and only create the concrete types in one place
If you don't own a copy go and beg, borrow or steal a copy of "Large Scale C++ Design" by John Lakos. It's a bit long in the tooth and a bit quirky but it describes how to write million line + systems and not die of boredom during recompilation. Also have a look at "Exception C++" by Herb Sutter for the sections on class design which describes some of the later points I've mentioned.
Cheers,
Ash
|
|
|
|
|
Hi!
I've defined two classes in the same header file. Is that a reason?
|
|
|
|
|
Well for that header to cause a rebuild of everything it'd have to be:
- included in everything, either directly or through another file
- modified
If the first is true it doesn't matter whether it has 1 or 100 classes, any change will cause a massive rebuild. Having said that though I'd advocate only having one class in a header file, it makes it easier to reduce dependencies if you do.
Cheers,
Ash
|
|
|
|
|
Hi!
Problem is: I removed the BIOS Battery. I forgot to set the correct date and time again.
|
|
|
|
|
Hi All
I am getting error CoInitialize has not been called.Code is here
void Ctest::OnCopyData()
{
::CoInitialize(NULL);
COleDataSource* pSource = CopyTextList();
if (!pSource)
return;
pSource->SetClipboard();
}
COleDataSource* Ctest::CopyTextFromList()
{
USES_CONVERSION;
CSharedFile sf(GMEM_MOVEABLE | GMEM_DDESHARE | GMEM_ZEROINIT);
CString str;
int nPos=m_test.GetItemCount();
for(int i=0;i<nPos;i++)
{
CString GetData=m_test.GetItemText(i,0);
str+=GetData;
str += _T("\r\n");
sf.Write(T2A(str.GetBuffer(1)), str.GetLength());
str.ReleaseBuffer();
}
char c = '\0';
sf.Write(&c, 1);
DWORD dwLen = (DWORD) sf.GetLength();
HGLOBAL hMem = sf.Detach();
if (!hMem)
return NULL;
hMem = ::GlobalReAlloc(hMem, dwLen, GMEM_MOVEABLE | GMEM_DDESHARE | GMEM_ZEROINIT);
if (!hMem)
return NULL;
COleDataSource* pSource = new COleDataSource();
pSource->CacheGlobalData(CF_TEXT, hMem);
return pSource;
}
Please help me
|
|
|
|
|
CoInitialize(NULL) does some stuff, so you better call it some time (100ms) before you need it to be finished.
Tip: you only need to call it one time per thread/app. Best in some startup code liek oninitdialog.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Try helping yourself. Here are some things to try:
- Find which line is causing the error
- When you've done that step through the code in a debugger and see if the function with CoInitialize() in is executed is before that
- Check that for every CoInitialize you've got a CoUninitialize
Cheers,
Ash
|
|
|
|
|
Are you aware CopyTextList is called, but you supplied code for CopyTextFromList ?
Also you only need CoInitialize once. Do that in your start up routine (CWinApp::InitInstance if it's MFC)
|
|
|
|
|
It's unuseful to call CoInitialize each time you need to use some COM object; call CoInitialize only once somewhere in your startup code instead.
Be aware that each call to CoInitialize should be balanced with a call to CoUninitialize .
From the code snippet you posted, it seems that you wrote your application using MFC, then the best places where put the calls are inside CWinApp::InitInstance and CWinApp::ExitInstance .
|
|
|
|