|
Does anbody know how to specify the parameters for the copy function of an Excel worksheet?
//get the second sheet in the workbook
_Worksheet sheet = sheets.GetItem(COleVariant((short)2));
//Now copy the worksheet into the same workbook
sheet.Copy(const VARIANT& Before, const VARIANT& After);
How do you go about specifying the params for the Copy function? I tried "Sheet2", "Template", using index of 2...
|
|
|
|
|
Howdy!
I was hoping that someone could tell me how to make my application get it's "fake" system colors (wich I define) on another place in the registry. I want to be able to redirect where my application(and mine only) gets its colors on another location in the registry. How would this be done in visual c++? And what would the code be like?
Thankfull for any answers,
/Fredrik
|
|
|
|
|
I don't understand what you're asking for. What do you mean by "gets it's colors"? What do you mean by "on another location in the registry"?
|
|
|
|
|
The dialog window looks for what colors windows have in the registry and uses these colors to color the dialog. Thats the system colors that are located in the registry under the key: "MyComputer\HKEY_CURRENT_USER\Control Panel\Colors". These are the so called system colors, the colors the system sets for your dialog (if you don't draw it yourself). What I want to do is, I'd like my dialog window to look for it's own colors in the same kind of way, but at another location, wich I would have define. Maybe, "MyComputer\HKEY_CURRENT_USER\Software\MyProgram\Colors" where I can set the dialog window colors myself. To do this, I have to change where in the registry my dialog window looks for it's colors. Adding the necissary keys and colors is no biggie, but how do I redirect where\how the program looks for these colors?
|
|
|
|
|
Sorry, but you simply can't do this.
In order to get different colors, you have to intercept the WM_CTLCOLOR messages for each control (or control type) and for the dialog itself.
|
|
|
|
|
Ah, would have been real neat though =)
Ok, could you help me with intercepting the WM_CTLCOLOR messages. I've tried this but I only managed to do it with te buttons, and used SetDialogBgColor() to chandge the dialogs "view" color, but a few things remain. The color of my slider, ComboBox, the menu, the boarder (or is it called frame) of the dialog window.
Thx, most thankfull for help. =)
/Fredrik
|
|
|
|
|
Hallo
Can somebody help me.
How can i record in realtime from a video camera to my hard drive??(AVI File) i need the code for AV and DV(firewire)
or somebody can tell me how they talk togheter.
B.R
BA
|
|
|
|
|
its very simple try using avicap class.it automatically save the video in file name capture.avi.there is a hell of detail in msdn or contact me i am also doing same things now a dayz
bye
bobbies_2001@yahoo.com
bobby
|
|
|
|
|
How to change the PropertySheet tab caption's color
|
|
|
|
|
So I've used the old _CrtDumpMemoryLeaks() and found my program has leaks. Now I want to use _crtSetBreakAlloc() to stop before these errors. However, during runtime none of the following expressions succesfully evaluate:
-> _crtBreakAlloc
-> {,,msvcr40d.dll}*__p__crtBreakAlloc()
-> {,,msvcrtd.dll}*__p__crtBreakAlloc()
and I've also tried setting my code configuration to Debug Multithreaded DLL, and Debug Single Threaded, Multithreaded DLL, all which produce the same result? I've also tried setting compile time _crtSetBreakAlloc(). Oh, and it is definetly the building in debug configuration.
Thanks in advance for any help...
Brendan Tregear
Scan Optics
32 Stirling Street
THEBARTON
SA 5031
|
|
|
|
|
I can't help much except to suggest that you state explicitly whether you are using MFC. Are you using VC 6?
|
|
|
|
|
Something I do on occasion (as per MSDN docs) is start the prog with F10, then during the initial break, bring up the watch window and type in _crtBreakAlloc. If its 'there' it should show as -1. I then manually enter the number of the allocation I'm trying to track down.
I should note that my exp with this has been with MFC, and CObject dumps. But this little test might serve to show you if the var is available.
|
|
|
|
|
Thanks for your help everyone but it still doesn't work. I've followed the directions exactly according to Knowledge Base Question ID: Q151585 "HOWTO: Use _crtBreakAlloc to Debug a Memory Allocation" without luck.
Looks like I'll have to get an off-the-shelf memory-leak detection package.
Thanks anyway
Brendan Tregear
|
|
|
|
|
Spending a day at home (nursing a cold - sympathy welcome) so thought I'd play with this a little bit - using a single threaded console application - and may have 'half a solution'.
The problem seems to be one of declaration and linkage - the prototype for _crtBreakAlloc begins with _CRTIMP, which resolves to nothing if not building a multithreaded dll. (Maybe the key is to place this stuff in a DLL and link with it)
Anyway, I managed to redefine and assign _crtBreakAlloc thusly:
extern long _cdecl _crtBreakAlloc = 21;
which the linker complained about. Telling the linker to use the FORCE switch got past that, and the allocation did cause a debug break.
Not a very robust solution though. Maybe someone else can expand on this. Would be nice to know a straightforward way of linking with these methods.
|
|
|
|
|
Thanks Tim, it works. You've got my sympathy *and* gratitude
Regards
Brendan Tregear
Scan Optics
32 Stirling St
THEBARTON
SA 5031
|
|
|
|
|
Hi Everyone,
I have a question regarding generating random number. Is there a function that can generate random number between a range without having the random number repeat itself?
For example, let's say I have 100 records in a database. i want to randomly select a certain number of records upon user input and make it as a new table.
if i use rand() function, and mod the numbers by 100, i'll get the numbers between 1 and 100, which then i can use to set the position of the record to copy that row of data. but the numbers might repeat themself if i select a large amount of records out of the 100.
is there a way to check the random number generated to see if it has already been selected before?
If anyone knows, plmk. thanks
steve
|
|
|
|
|
Sure, just store each random number generated in a map or list.
#include
std::map<int, bool=""> gen;
int x = randomnumberfuncitonyouarecalling();
if (gen[x] == false)
{
// do your code
gen[x] = true;
}
else
{
// try again
}
|
|
|
|
|
Hi Steve,
A standard procedure for this problem is to generate a sequence 1..n and pemutate these numbers randomly (n log n times should do the job). This is efficient if you want to access a certain number of items mutliple times.
Wolfgang
|
|
|
|
|
How can I change extended style on startup or under the time dialog is active.
|
|
|
|
|
|
How do I create a DLL that there can only ever be one instance of it.
Details:
I need a server that is shared by many processes.
This server will be registering each process that loads it.
When the server is notified of deltas by an EXE that will start it, it will in turn broadcast to each registered process.
So, there can be only one data segment.
|
|
|
|
|
You're kind of throwing the baby out with the bathwater.
There is no reason you should have to require that a DLL is only loaded once. There are many ways share data between multiple instances of a module (such as DLL's). Shared data segments (check the linker options for this) and memory mapped files with page backing (essentially maps the same memory into the swap file and allows mutliple processes to read and write to it) for instance.
Further, you can accomplish this without sharing memory. This is precisely what out of process COM objects are designed to handle.
There are lots of solutions besides this (which is basically impossible in 32 bit anyways, since each DLL is mapped into each programs address space. )
|
|
|
|
|
Thanks for the feedback Erik,
Perhaps I mistated my End-Goal.
We need a dll that no matter how many clients load it, they all get exactly the same one from the perspective of Connection Points.
What we have is an EXE that will load the dll initially.
The Listener.dll is an AddIn for Visual Source Safe to trap SourceSafe events.
Once the EXE has loaded the Listener.dll, then it will load ssapi.dll (sourcesafe).
ssapi.dll will load our Listener.dll again.
Then many clients will register with the listener to be notified of changes to the source safe database.
Only the instance started by SourceSafe is the one that will recieve the events from sourcesafe.
Am I goofy or what? I have not successfully built a singleton dll. singleton exe, yes. ?????????????
Isn't singleton the solution?
|
|
|
|
|
No. You simply cannot have what you want under Win32. The reason is simple. A DLL is loaded into each processes address space. Without that, a program couldn't access the DLL since it wouldn't exist in it's virtual space.
Under Win16, there was only one global address space, so DLL's were only loaded once. But in Win32, each program has it's own and DLL's can be relocated anywhere in the space if some code already exists at the preferred loading address.
That's why I suggested shared memory segments to share the common data.
|
|
|
|
|
Ok, I'm aware that it lacks in details, but that's what I have so far:
Someone here implemeted a skin mechanism for an application.
He uses a script and compiles it into a resource list.
I'm pretty sure he used bitmap streching for resizing.
The problem is this:
Resizible windows that he defines as Dialogs leave ugly background color marks when resizing them. This only happens on Win9x (Inferior GDI performance?). Windows that are defined as CWnd and not CDialog do not leave the color traces.
Any leads on where to start solving the color traces of the dialogs? How is Dialog resizing different from windows resizing?
Thank you, Any help would be great.
Ori
|
|
|
|