|
This tells me that your drop down is too small.
Sorry. I just read how that can be taken.
Anyway, this thread should help you in determing how to, er, lengthen your drop down.
Cheers,
Tom Archer
Author, Inside C#
Author, Visual C++.NET Bible
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the af
|
|
|
|
|
Tom Archer wrote:
What MFC stuff?
LOL
I can imagine how you just stood there stunned.
I mean you type in a post, two pages long and then he says this
Nish
The posting stats are now in PDF:-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
Updated - May 04th, Saturday
|
|
|
|
|
He's probably used to getting MFC replies even though he's requested a Win32 solution.
Cheers,
Tom Archer
Author, Inside C#
Author, Visual C++.NET Bible
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the af
|
|
|
|
|
Tom Archer wrote:
He's probably used to getting MFC replies even though he's requested a Win32 solution.
Yeah
Possible.
Of course maybe he remembers how a guy here asked a CString question and suddenly another *guy* asks him if he is using MFC
Nish
The posting stats are now in PDF:-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
Updated - May 04th, Saturday
|
|
|
|
|
This has nothing to do with answering your question, but you might find this link helpful!
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Anonymous wrote:
WHat am i doing wrong?
I don't know. But here are some things to check:- If it is not already,
gszGenres should be defined something like this:
const char* gszGenres[] =
{
"Rock",
"Heavy Metal",
"Ancient ('70s) Rock",
"Fake ('80s) Rock",
"Industrial",
"Trance",
"Trip Hop",
"Rap",
"Baroque",
"Blues",
"Pop"
};
const int nNumGenres = sizeof(gszGenres)/sizeof(char*); - If there are really 148 strings in
gszGenres , then this loop will skip one, since it only loops 147 times (i = 0 to 146). If you use the code above, you can use nNumGenres to avoid hard-coding this value. - How is
DlgItems defined? Can you avoid hard-coding indices somehow? - Are you positive
DlgItems[5] is the correct HWND ? Put in a breakpoint and check.
--------
People they come together
People they fall apart.
No one can stop us now
'cause we are all made of stars... -- Moby, We are all made of stars
|
|
|
|
|
How to change screen resolution programmatically
(instead of 'Display properties->Settings')? Ha?
10X Yoll!
--BlackSmith--
"With the help of all mighty", 2002, Me.
|
|
|
|
|
|
See this article.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I loaded a bitmap by CBitmap object.
Can you tell me, how can i rotate it ?
Please help me ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Have you checked GDI part in CP?I remember something like this could find in some articles.
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
Sorry, yes.
I must look at to MSDN better,
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
|
Hey guys,
I'm writing a windows interface for a DOS program, which needs to trap the output and send keyboard input to the DOS program. I've tried CreateProcess and rerouting stdin and stdout, but to no avail. I think they've coded the DOS interface using direct BIOS calls or writing to screen memory. Is there any way to trap screen output that has been coded in this way? The other problem is sending keypresses to the program - stdin isn't working either.
Any clues would be greatly appreciated.
Cheers,
Paul
|
|
|
|
|
I have a dll project in visual c++
and I want to have a variable which will change by different exe files which use this dll.
for example if i have
"int i=0; //global var of the dll file
.....
int func
{
if (....)
i++;
}
"
I would like i to be 1 for the next time func is called by a differet exe file.
thanks,
Aviv.
avivhal
|
|
|
|
|
You need to put your data that will be shared across multiple invocations of the DLL into a shared memory segment. For example, the following declares a static variable (connections) in a shared data segment called .SHARDAT
#pragma data_seg(".SHARDAT")
static int connections = 0;
#pragma data_seg()
Cheers,
Tom Archer
Author, Inside C#
Author, Visual C++.NET Bible
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the af
|
|
|
|
|
and how do I access this variable from various files?
avivhal
|
|
|
|
|
I'm not sure I follow your question.
Here are the steps to share data across multiple invocations of a DLL. In this example, I'm keeping track of the number of connected users to this DLL.
Server side (Dll)
- Create a Win32 DLL (I called mine DllSharedDataServer)
- Create a header file for the DLL (DllSharedDataServer.h)
- Add the following code to define the shared data. Note that I would normally just define this in the DLL's main CPP file, but I'm guessing from your question that your DLL has multiple CPP files, all of which need access to this variable.
#pragma once
#pragma data_seg(".SHARDAT")
static int connections = 0;
#pragma data_seg()
- Add the following function to the DllSharedDataServer.h header file so that clients can query as to the number of connected users.
int GetNumberOfConnections();
- Add an include directive to the DllSharedDataServer.cpp file
#include "DllSharedDataServer.h"
- Update the DllMain function to increment the number of connected users when a client attaches and decrement the counter when a client detaches:
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
connections++;
break;
case DLL_PROCESS_DETACH:
connections--;
break;
default:
break;
}
return TRUE;
}
- Add the GetNumberOfConnections function to return the counter's value
int GetNumberOfConnections()
{
return connections;
}
- Add a DEF file to the DLL and update it as follows so that the GetNumberOfConnections function is exported and the shared data segment is properly defined:
LIBRARY DllSharedDataServer
SECTIONS
.SHARDAT READ WRITE SHARED
EXPORTS
GetNumberOfConnections
- Build the DLL
Client side
- Create an MFC dialog-based app to test with (DllSharedDataClient). In cases like this where the two projects are meant to work together I usually specify the Add to solution option so that it's easier to work on both projects at the same time.
- Include the DllSharedDataServer.h file in the DllSharedDataClientDlg.cpp file.
- In the dialog's OnOK handler place the following call to the GetNumberOfConnections function
void CDllSharedDataClient1Dlg::OnBnClickedOk()
{
int i = GetNumberOfConnections();
CString str;
str.Format("There are currently %ld connections to the DLL", i);
AfxMessageBox(str);
}
- Add the DllSharedDataServer.lib to the DllSharedDataClient project
- Build the client
- Finally, copy the DLL to a folder where it can be found when running the client.
Testing the DLL
Now simply run a few instances of the client and you will see that each time you click the OK button the correct number of connections will be displayed; thereby proving that your data is being shared among multiple connections to the DLL.
Cheers,
Tom Archer
Author, Inside C#
Author, Visual C++.NET Bible
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the af
|
|
|
|
|
I would like to point out that this method does not guarantee that the variable will be shared. Only if the dll is mapped into the same memory address in each process will it work. If one of the processes remaps the dll because of a collision with another dll then that process will have it's own copy.
Joel Lucsy (jjlucsy@ameritech.net)
|
|
|
|
|
True, but if someone is using something like REBASE to manually remap DLLs for performance considerations, then I figure they already know how to define shared data segments.
Cheers,
Tom Archer
Author - Inside C#, Visual C++.NET Bible
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the af
|
|
|
|
|
The point, however, is that this problem can manifest itself without a manual REBASE. Say two dlls have not been rebased and are loaded automatically by the system and by themselves would load into the same memory locations. If your dll is loaded second then the shared segment won't be effective.
This problem can be avoided by smartly rebasing your dll itself into a "safe" area, but there are no guarantees. If you know it's always "your" executable that loads it, or that you know what dlls the target executable will load, then you're all set. Global hooks from dlls have a greater chance of remapped since you can't know all the executables that it might be loaded into.
Now, I'm not saying don't use shared memory segments. But I'm just trying to keep everyone informed of the issues.
Joel Lucsy (jjlucsy@ameritech.net)
|
|
|
|
|
Extremely good points, Joel. Thanks for the input!
Cheers,
Tom Archer
Author - Inside C#, Visual C++.NET Bible
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the af
|
|
|
|
|
Hi All,
I am trying to simulate a ID_FILE_OPEN command from a button click instead of the applications main menu.
Seem like I should just be able to send or post a message, but I have not stumbled on the answer.
A point in the right direction would be appreciated.
Thanks, Paul
|
|
|
|
|
AfxGetMainWnd()->PostMessage(WM_COMMAND,ID_FILE_OPEN,0);
should do the trick
situations to avoid #37: "good morning ... how many sugars do you take in your coffee ... and what was your name again?"
coming soon: situations to avoid #38: "...and the dog was there too?"
|
|
|
|
|
I was sooooo close.
Sometimes it takes help from people willing to give it !!!
Thank you lauren
Paul
|
|
|
|