|
Anyone have any ideas how to access resources linked into a static library? In a MFC dialog application, I am trying to access the dialog template and supporting class from a static library and not having much luck. I have verified that the resource has been compiled into the library and the library is in the path.
The goal is to be able to distribute just a library and the header file for use in other applications, similar to the way CFileDialog works (add header file, instantiate CFileDialog and you're good to go). There may not be a way to do this since I suspect the resource compiler only comprehends a single resource file; but if anyone would know how to do this, it would be a codeproject member.
Thank you for any help.
severehammer@yahoo.com
|
|
|
|
|
I don't think you can add resources to libraries, that means, to .lib files. The way CFileDialog works is that you call a function which resides in a DLL, and the resources are in this DLL. Resources can only be added to executables, these are EXE or DLL files.
Martin
|
|
|
|
|
I am working on a project that requires a global hook.
I only need to process a single message (WM_ACTIVATE), and I am using a WH_CALLWNDPROCRET type hook.
Basically if I get this message I fire off another thread in the DLL that runs at THREAD_PRIORITY_LOWEST that modifies some of the window's styles.
Anyway, when the hook is running taskmgr takes about 30% - 40% of the CPU time with nothing else going on. I assume this is from processing the messages because moving the mouse quickly increases this to 50% - 60%. The first thing I do in the hook is check if it is the message I want, and if it is not I call the next hook.
I am also checking for nCode < 0 and calling the next hook without executing mine if this is true.
Can anyone tell me what the best performance hook is? I think it is weird that the hook causes that much CPU usage in taskmgr.
Oh, yes I am using DisableThreadLibraryCalls() for each process that uses the DLL.
Thanks!
--
Dana Holt
Xenos Software
|
|
|
|
|
I'm use WH_GETMESSAGE and WH_SHELL hooks in my program without any strange performance effects. Why do you need to create separate thread? I'm perform needed actions by posting message (PostMessage API) in main window when I plan to do long time action handling (because PostMessage don't stops the thread), and by sending message (SendMessage API) for simple actions.
Sorry for wrong English )
|
|
|
|
|
Hi,
In a dialog-based application, i need finding all of the cd-rom
drivers and then needs open, close, read and write the to cd-rom.
I want to use the low-level SCSI commands to operate all of these.
I want to know if it is possible for embeding such low-level
scsi commands code into the VC++ code. Where can i get some
useful info for doing this? Where can i find some materials (simple
example code) for SCSI commands code?
Thanks in advance!
chen
|
|
|
|
|
|
Hi Dana Holt,
Thanks a lot!
I have read the materials about ASPI for win32. and download
some files. I try to make a simple test program.
I have scsidefs.h, wnaspi32.h and some code such as AspiStart()
ScsiBusScan(),ScsiInquiry(), ... , but i failed. Is there other header files i am missing ?
chen
|
|
|
|
|
chen wrote:
I have read the materials about ASPI for win32. and download
some files. I try to make a simple test program.
I have scsidefs.h, wnaspi32.h and some code such as AspiStart()
ScsiBusScan(),ScsiInquiry(), ... , but i failed. Is there other header files i am missing ?
I have not gotten a chance to write any code, so am not sure what the problem would be.
Did the program compile? If so, then the header files should be ok.
That's about all the help I can offer with my experience.
--
Dana Holt
Xenos Software
|
|
|
|
|
You might want to check out akrip.
|
|
|
|
|
I have a static control on a dialog which has the 'Notify' style set, so that it sends notification messages when clicked on. But if I click on the control when it contains no text it pops up an Explorer window, this doesn't happen when the control contains text. I used Spy++ to check the messages the dialog window was getting and this is the result:
1. Mouse click on static control containing text (ok)...
<00207> 00170324 R WM_ACTIVATE
<00208> 00170324 S DM_GETDEFID
<00209> 00170324 R DM_GETDEFID wHasDef:DC_HASDEFID wDefID:0001
<00210> 00170324 S WM_COMMAND wNotifyCode:STN_CLICKED wID:1003 hwndCtl:0016048E
2. Mouse click on static control not containing text (pops up Explorer window)...
<00173> 00130326 R WM_ACTIVATE
<00174> 00130326 S DM_GETDEFID
<00175> 00130326 R DM_GETDEFID wHasDef:DC_HASDEFID wDefID:0001
<00176> 00130326 S WM_DDE_INITIATE hwnd:000A0418 aApp:C049 ("Folders") aTopic:C04A ("AppProperties")
<00177> 00130326 R WM_DDE_INITIATE
...
<00228> 00130326 S WM_COMMAND wNotifyCode:STN_CLICKED wID:1003 hwndCtl:001104DE
I looks like the WM_DDE_INITIATE message is the problem, but where is this message coming from?! and why?
|
|
|
|
|
|
Hello,
I'm have the need to write a custom window arrangement routine (like the normal tile, cascade, etc) in an MFC MDI app.
What i'm need to do is "stack" MDI child windows of a certain CMdiChildWnd derived type, while minimizing all other MDIChild frame windows.
Does CMidFrameWnd maintain a list of pointers to it's child frame windows? If not, any idea how i can enumerate the child frames, and figure out what CMDIChildWnd-derived type they are?
Thanks,
Heywood
|
|
|
|
|
Hi !
I was working on Device Independent Bitmap (DIB) and wanted to shrink my image down to a thumbnail size, so used the
StretchDIBits() function.
But the shrinking lead to a severe color loss. Why ????
Is there anyway I can shrink my DIB without color loss.
Please Help
|
|
|
|
|
SetStretchBltMode(COLORONCOLOR);
-c
Cheap oil. It's worth it!
|
|
|
|
|
Hi !!
It worked just fine.. The image is perfect now.
Thanks a lot.
Green.
|
|
|
|
|
If you don't mind it still looking bad on Win9x, you can try calling SetStretchBltMode(HALFTONE); prior to calling StretchDIBits() . Caveat: i know it works with StretchBlt() , but i've never tried it with StretchDIBits() .
---Shog9---
From now on we can call C# and MC++ "The square wheel languages" -- Jack Handy, The Lounge
|
|
|
|
|
Hi !!
Well, It did work for StretchDIBits().
The image is perfect now...
Thanks a lot.
Green.
|
|
|
|
|
Hi !!
Well, It worked for StretchDIBits().
The image is perfect now...
Thanks a lot.
Green.
|
|
|
|
|
Hi.
I have an interesting problem. I am working on a program with with a CEditView window. I use GetEditCtrl().SetWindowsText to update the view with new text. Whenever I call SetWIndowsText, the CEditView repaint the entire view, but it always resets the scroll position. For example, let say I am view line 200. (line 200 is at top of view). Whenever I update the view, CEditView resets the current view to line 0.
Is there a way to set what line should CEditView beginning?
Thanks,
Kuphryn
|
|
|
|
|
Use
CEdit& edit = GetEditCtrl() ;
edit.LineScroll(200,0) ;
|
|
|
|
|
Thanks.
A special thanks to Scott McPhillips of MSDN newsgroup also for the solution (he posted it yesterday).
Kuphryn
|
|
|
|
|
Hi,
CStringArray& MyArrayFunction()
{
CStringArray aArray;
aArray.SetSize(...
aArray.SetAt(...
...
return aArray;
}
Question1: is the return line OK?
Question2: how can I fill another array in my code with the returned stringarray?
I tried
CStringArray aMyArray = MyArrayFunction();
but
error C2440: 'initializing' : cannot convert from 'class CStringArray' to 'class CStringArray'
is the answer.
Could you please help me?
Thanks a lot
Ricardo
|
|
|
|
|
change to:
CStringArray* MyArrayFunction()
{
CStringArray *paArray = new CStringArray();
paArray->SetSize(...);
return paArray;
}
getting the array
CStringArray *paMyArray = MyArrayFunction();
do not foget to delete paMyArray;
soptest
|
|
|
|
|
|
I have the following problem. I have included this header file many times in my code with no problems. Then I "included" it into a new file which now produces errors in my typedef statement. I really dont know if it is a problem with namespace as I have no idea how to use that correctly anyway.
Code for "entity.h"
<br />
#include <list.h><br />
<br />
using namespace std ;<br />
<br />
typedef struct<br />
{<br />
int ref;<br />
std::string name;<br />
<br />
}EntityData;<br />
typedef list<EntityData> ENTITYLIST;<br />
How can I include this file with out errors??
Code for "NewFile.cpp"
<br />
#include "stdafx.h"<br />
#include "NewFile.h"<br />
#include <list.h><br />
#include "entity.h"
using namespace std;
Pease help!!
---
|
|
|
|