|
The easiest way (AFAIK) is to use ExtractIconEx() . However, this will not let you specify the color depth or dimensions of the device image you wish to load (other than the system-defined large and small sizes), so if you're using non-standard sizes (i.e. for toolbar buttons) then my next suggestion would be using LoadLibrary() and LoadImage() .
Shog9
|
|
|
|
|
Thanks fro the advice!
- Matt Newman / Windows XP Activist
-Sonork ID: 100.11179
"You can't seriously believe that you could get away with suing someone over quoting text from a message posted in a public forum, can you?" - John Simmons
|
|
|
|
|
Hi,
I am writing a DLL for a game engine, and I want to include the option to disable task-switching while the game is being played. In other words, I want to disable:
alt-tab
ctrl-alt-delete
ctrl-esc
(The main reason for this is that graphics drivers bugs tend to show up after task switching, and also I am using a file packer that can be cracked quite easily if you can task-switch.)
My question is, what is the best way to go about this? I have seen a lot of stuff about using SystemParametersInfo and SPI_SCREENSAVERRUNNING, but this unfortunately only works on Win95/98/Me, and I want my DLL to work on all platforms. I have seen some code about low-level keyboard hooks for NT too, but so far I have unable to get any of this working properly (I have Win Me myself).
If anybody could give me some suggestions/pointers or just tell me the simplest or most effective way of doing this, I would be very grateful.
Many thanks,
KB
|
|
|
|
|
|
dont forget ctrl+shift+esc, and all the predefined windows keys (win+e ...)
int x=1, y=5;
x^=y^=x^=y;
<a href="http://www.codeproject.com/tips/StupidXORTrick.asp" target="_blank">ClickHereForHelp();</a>
|
|
|
|
|
I've got 2 applications that load the same dll. The 2 instances of the dll communicate with each other using shared memory.
#pragma data_seg(".shared")<br />
...<br />
#pragma data_seg()
But this only works for base types like integers and doubles. What I would like to have is a shared linked-list, containing a list of objects. Those objects have the basic linked list members (*prev, *next) and an extra char* for the name.
In fact, a linked list is not required, it can be a vector too, or another type ...
What's the best way to do this?
What classes or typelibrary would I have to use?
stl?
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
From Visual C++ help:
However, if you need to share a C++ class instance, you should use a memory-mapped file, because each time a process attaches to the DLL, the constructor for the object is called. For example:
#pragma data_seg(".myseg")
_declspec(dllexport) CTest Counter1(0);
_declspec(dllexport) short Counter2 = 0;
#pragma data_seg()
Assume that the variables Counter1 and Counter2 are incremented in a function in the DLL. The value of Counter2 increases as expected, but on each process attach, the constructor for Counter1 is called reinitializing it to zero. In order to share Counter1, you must use a memory-mapped file. For more information about memory-mapped files, see File Mapping in the Win32 SDK documentation.
I guess you could use data_seg with pointer to linked list, but this would introduce problems with different heaps each dll instance uses.
[edit]
Disregard the idea with pointer - it would have no meaning, since actual object would live in address space of one process. Seems that going with File Mapping is only choice.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
File mapping, that's it allright
I hope that's not too buggy, that ms lib.
tnx!
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
Grote Smurf (aka frisco) wrote:
I hope that's not too buggy, that ms lib
File mapping is a feature implemented at OS level - so it's hardly a 'lib'
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
So, it's really "core"-gates stuff? I'm already having a breakdown ...
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
|
Almost finished ...
It's not so hard cause I don't need to syncronise between processes. One process writes and another reads. While one process writes, the read processes can be disposed without further action.
With syncronisation, that's another pair of sleeves
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
Hello,
I need to include instructions of compiling different kinds of files to others. I have all those compilers on my computer, but how can I tell my makefile or visual studio where they are. I know I could put the path in front of the compiler name, but the problem is that some of those use preprocessors and those I don't call myself.
-Janetta
|
|
|
|
|
In VC, you can use the Tools:options and directories to configure the executable files (paths) that are searched for the compilers/linkers used in your makefile.
Roger Allen
Sonork 100.10016
I think I need a new quote, I am on the prowl, so look out for a soft cute furry looking animal, which is really a Hippo in disguise. Its probably me.
|
|
|
|
|
I use the splitter window in my project.Left view is derived from CTreeView , and the right view derived from CFormView.I added MS FlexGrid 6.0 and Remote Data Control 6.0 onto Form , set the DataSource of FlexGrid is connect to the RDC.Complied successfully,but when run it , reported Assert error.
Why?
Sincerely,Pole.
|
|
|
|
|
This:
Pole wrote:
Complied successfully,but when run it , reported Assert error.
is a bit vague.
Without knowing details about FlexGrid and RemoteDataControl I try to answer...
You are not trying to access the control variables before the OnInitialUpdate() has been called?
At that Time they may not yet exist.
|
|
|
|
|
I set the FlexGrid's Datasource attribute in Resource Editor.I did not code a line.
Sincerely,Pole.
|
|
|
|
|
Pole wrote:
I set the FlexGrid's Datasource attribute in Resource Editor.I did not code a line.
Maybe it is better to set the FlexGrid's Datasource attribute in ViewClass::InitialUpdate()?
|
|
|
|
|
But how to code it?I tried to do it like you say,but failed.
Sincerely,Pole.
|
|
|
|
|
In yout CFormView derived Class, you can use the C++ Class Wizard to make you a Handler for the Message 'OnInitialUpdate'.
In the body of this message-handler function, you can do the calls needed.
OnInitialUpdate() is the right function for all first-time initialisations of views and their childs.
|
|
|
|
|
I know that,but I don't know how to set FlexGrid's DataSource so that connect to the RDC(Remote Data Ctrl).
How to pragrammically set its DataSource attribute?
Sincerely,Pole.
|
|
|
|
|
Hello,
I’m trying to load A listbox object with table names from an access database file. I’m working with two dialogs. One is my main Dialog and the other is a dialog with a listbox object attached to it. When I try to add table names
To the list box an ASSERTION happens. I believe the Dialog with the listbox is destroyed before the AddString() function can load the table names. If this is true is there away around this? Any help would be much appreciated.
Thanks
Karl
<br />
void CLoadTablesDlg::OnButtonOpen() <br />
{<br />
CTableDlg dlgTable;<br />
<br />
_RecordsetPtr m_pRstOpenSchema;<br />
_ConnectionPtr m_pConnection;<br />
<br />
TCHAR szFilters[] = _T("Access files(*.mdb) | *.mdb | All files(*.*) | *.*||");<br />
<br />
CFileDialog dlg (TRUE, _T("mdb"), _T("*.mdb"),<br />
OFN_FILEMUSTEXIST | OFN_HIDEREADONLY, szFilters);<br />
<br />
if(dlg.DoModal () == IDOK)<br />
m_sFileName = dlg.GetPathName();<br />
<br />
HRESULT hr;<br />
<br />
_bstr_t strCnn("Provider=Microsoft.Jet.OLEDB.3.51; Data Source= " + m_sFileName + ";");<br />
<br />
try<br />
{<br />
hr = m_pConnection.CreateInstance(__uuidof(Connection));<br />
if(SUCCEEDED(hr))<br />
{<br />
m_pConnection->Open(strCnn, "", "", adModeUnknown);<br />
m_pRstOpenSchema = m_pConnection->OpenSchema(adSchemaTables);<br />
<br />
while (!(m_pRstOpenSchema->adoEOF))<br />
{<br />
_bstr_t table_name = m_pRstOpenSchema->Fields->GetItem("TABLE_NAME")->Value;<br />
<br />
CString strTableName = (LPCSTR)table_name;<br />
dlgTable.m_lstTables.AddString(strTableName);<br />
m_pRstOpenSchema->MoveNext();<br />
}<br />
<br />
}<br />
}<br />
catch (_com_error &e)<br />
{<br />
_bstr_t bstrSource(e.Source());<br />
_bstr_t bstrDescription(e.Description());<br />
TRACE( "Exception thrown for classes generated by #import" );<br />
TRACE( "\tCode = %08lx\n", e.Error());<br />
TRACE( "\tCode meaning = %s\n", e.ErrorMessage());<br />
TRACE( "\tSource = %s\n", (LPCTSTR) bstrSource);<br />
TRACE( "\tDescription = %s\n", (LPCTSTR) bstrDescription);<br />
}<br />
catch(...)<br />
{<br />
TRACE( "*** Unhandled Exception ***" );<br />
}<br />
<br />
}<br />
|
|
|
|
|
You can call AddString only after DoDataExchange was called (it's called by CDialog::OnInitDialog) and before dialog ends modal state.
You'll have to add strings in DoDataExchange or in InitDialog.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
Russ Freeman wrote:
I want to add a toolbar to a view and I would like it to use the command routing for enabling and disabling of buttons
You don't route commands through toolbar. All you need to do is ensure that CToolBar::OnUpdateCmdUI is called - it will use MFC routing for enabling/disabling buttons.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
Hi,
I'm trying to send a piece of mail using Simple MAPI's MAPISendMail function and, the linker is complaining that it can't find the function.
I'm linking to mapi32.lib, but this seems not to contain the function (mapi32.dll does, however, because I can access it from GetProcAddress). Does anyone know what the problem is?
Thanks,
Rich
|
|
|
|