|
True, true, sorry about that...int math was simpler...
~Cam Desautels (BinaryUprising.com)
|
|
|
|
|
You might want to have a look at this little article. It is a set of classes built to take numeric input from edit boxes and it handles a lot of those messy details for you. There are facilities to use sliders also but you don't have to.
I hope this helps.
|
|
|
|
|
But it's so simple, really. And the point is to learn. Once he gets it down he'll be pumping these things out in no time, and wondering what was slowin' him down before.
~Cam Desautels (BinaryUprising.com)
|
|
|
|
|
You guys are awesome, Thanks for your help!!
|
|
|
|
|
|
Cam, I'm sorry I didn't say. Yes, I got it owkring. Thanks a lot for your help! It's impressive to see that there are people out there that seem to REALLY care. Your code and that srticle that Rich sent me to set me right. THANKS! By the way, GREAT web site!
|
|
|
|
|
Sorry about the typos, I'm pretty tired now.
|
|
|
|
|
Sorry about the typos, I'm really tired now. Good night
|
|
|
|
|
Ok, very cool, very cool...no problem about the help, I'm a struggling C++ programmer myself (yeah, but what the heck, I'm 17, it'll come...), and if I help others with what I can, maybe someone can help me when the time comes. Thanks a lot about my site, I have a lot of fun with webdev. Did you see there's a little text box on the right-hand side of the homepage where you can post comments (hint, hint). LOL, anyway, the best of luck to you, I'm glad I could help.
~Cam Desautels (BinaryUprising.com)
|
|
|
|
|
i have created a new project with a recordset.
with the toolbar that the wizard supplied i can navigate throught the records but i can not figure out where i can update controls on my dialog when navigating.
thank you for any help
|
|
|
|
|
Hi,
U have to use the Recordset to bind the dilaog controls to the
recordset fields.
U can do this by the RFX_ macros and attaching by using the DDX macros
by hand, that's a little tediuos, but
u can do automatically in the following manner.
1. When the Dialog is open in the Resource Window.
2. Select a control and open class Wizard(Ctrl+W)
3. Then depending on the control u selected and to the
field u want to display in the control
4. Select the control and go to the 'Members Variables' tab
5. Select the control and press 'Add Variable'
6. In the Member vaiable name --> Select the Recordset field u want
to associate.
Phew,
Thats all.
|
|
|
|
|
thank you could not be easier
|
|
|
|
|
can i cast a member func ptr to global func ptr
(without a compilation error...)?
typedef void (*Func)();
class Moo{
void Do();
void Cast_A_Func(){ m_fn = (Func)(void*)Do; } //Or something like that...
Func m_fn;
};
--BlackSmith--
"With the help of all mighty", 2001, Me.
|
|
|
|
|
No, because member functions have 'this' as their first argument (although you don't write it that way). Your code will work only if Do() is static, since static methods have no this pointer.
--Mike--
http://home.inreach.com/mdunn/
"Not our fault we are intellectually superior to the rest of the office." -- Paul Watson in the Lounge, 12/12/2001
Sonork - 100.10414 AcidHelm
|
|
|
|
|
Well, if you're in desperate need of treating a pointer to member function as a regular pointer to function, and you can afford changing the calling convention of your member function, then there is a tricky, heavily non-portable workaround: Consider the following class:
class A
{
public:
int __cdecl f(int a_){a=a_; return a+1;}
private:
int a;
}; From the point of view of the compiler, A::f is called like a regular function having a first hidden parameter that provides the this pointer. That is, the types PMEMBFUNCTION and PFUNCTION , defined as
typedef int (__cdecl A::* PMEMBFUNCTION)(int);
typedef int (__cdecl * PFUNCTION) (A*,int); are equivalent in the sense that the compiler generates the same code to execute calls for them. Alas, this kind of equivalence does not allow us to force a cast between the types. So the snippet of code
A a;
PMEMBFUNCTION pmf=A::f;
PFUNCTION pf=reinterpret_cast<PFUNCTION>(pmf); does not compile: from the compiler point of view, the types involved are wildly disimilar. Tricks like trying an intermediate cast to void * do not work either.
Not all hope is lost, nevertheless. We can use a last resort to force the casting. This struct
struct caster{
union{
PMEMBFUNCTION pmf;
PFUNCTION pf;
};
}; implicitly does the casting for us: the union allows us to store a PMEMBFUNCTION and retrieve a PFUNCTION . This kind of "casting" is even stronger than the allmighty reinterpret_cast !
So here's a complete program that shows how to call A::f as a regular function, providing the extra this parameter. I hope the technique is clear after this exposition.
#include <iostream>
using namespace std;
class A
{
public:
int __cdecl f(int a_){a=a_; return a+1;}
private:
int a;
};
typedef int (__cdecl A::* PMEMBFUNCTION)(int);
typedef int (__cdecl * PFUNCTION) (A*,int);
struct caster{
union{
PMEMBFUNCTION pmf;
PFUNCTION pf;
};
};
int main(void)
{
A a;
caster c; c.pmf=A::f;
PFUNCTION pf=c.pf;
cout<<pf(&a,666)<<endl;
return 0;
} One major drawback of this trick (apart from being scandalously non-portable) is that the member function has to be declared with the __cdecl calling convention. Why is this so? Well, if no calling convention is specified, the compiler uses the default __thiscall . In this calling convention, normal parameters are passed to the member function as in __cdecl , but the this pointer is stored in register ECX. You cannot simulate this behavior when calling a regular function, unless you use some assembly code.
Also, this definitely does not work with virtual member functions.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
hello!
i have a problem with SendInput function...
i need to simulate the Ctrl+C... and after it i'm getting the text string from Clipboard...
but there is a delay between the SendInput is called and the keys are simulated... and when i'm getting the text from Clipboard, i'm getting the old Clipboard data...
what should i do?
maybe i need to use some delay function after SendInput?...
if you know any delay functions, please tell me...
|
|
|
|
|
Install a clipboard viewer, and you'll know exactly when the contents of the clipboard change. See my article ClipSpy in the clipboard section, which demonstrates a clipboard viewer.
--Mike--
http://home.inreach.com/mdunn/
"Not our fault we are intellectually superior to the rest of the office." -- Paul Watson in the Lounge, 12/12/2001
Sonork - 100.10414 AcidHelm
|
|
|
|
|
I have an SDI app where the CMainFrame is broken up with static CSplitterWnds. When I create the view (CKeypadView) with CreateView() it properly passes in the pointer to the CDocument.
m_splRightCol.CreateView( 2, 0, RUNTIME_CLASS(CKeypadView), CSize(0,0), pContext )
When I break when the OnUpdate() is called from the OnInitialUpdate() the pointer now reads NULL. Why?
------------------------------------------------
I am not discouraged because every wrong attempt discarded is another step forward
-- Thomas Edison --
|
|
|
|
|
Hello, the codegurus around the world.;)
OnInitUpdate() function is called a couple of times before acutally
its view is created (?) or is visiable.
So, you must add the validation code to check if some controls in OnInitUpdate() have their own HWND or CWnd (not NULL).
Please, don't send me your email about your questions directly.
Have a nice day!
Sonork - 100.10571:vcdeveloper
-Masaaki Onishi-
|
|
|
|
|
I removed the code that tries to access the CDocument from OnUpdate(), but even when I try to access the document later on (using GetDocument() ), it still doesn't have a pointer to the document. All other views still have a valid pointer.
Make no little plans; they have no magic to stir your blood to action. Make big plans, aim high in work and hope.
-- Daniel Burnham
|
|
|
|
|
I was wondering... is it possible to create an executable (.exe) that has a dll entry-point as well as a normal application entry-point, that is: a WinMain function that would be called when the file is executed, and a DllMain that would be called if the file is loaded by LoadLibrary (or something similar).
Thanks for any info
Enjoy!
Marc
|
|
|
|
|
That is a curious question. I do not know but you could give it a try. Place those and a few other functions in your .exe's code and put "__declspec(dllexport)" in front of them and see what happens. Run "dumpbin /EXPORTS" at a command prompt to see if it really worked.
I do a related thing in my company's product. We often run multiple instances (sometimes dozens) of the same process so I have nearly all of the code in a DLL. The main function for this process looks like this :
int main(int ac, char*av[])
{
return MyLibrary(ac,av);
}
This gives each process minimal memory usage.
|
|
|
|
|
Mark:
A dll and a exe are similar, you can export function from a exe or from a dll, you can make all a application that is in a dll. The diference is that you need to know that you are calling a dll or a exe, because if you are calling a exe, this will be callin the winmain function or other function that you want to determine how entry point, but if you are calling a dll that have a application in, you need to know the ameof the function...
Sometimes I make that, I make a exe and this app, call dll like plugins....
best regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
I know, but I was just wondering if it was possible to have both things in one file. Of course, it is possible to export functions from the exe file, but if it needs to be able to initialize itself before these functions are called a DllMain function would be nice in addition to WinMain. (of course, i could call an initialization routine from the exported functions, but that's not as fun )
Actually what I'm trying to do is to make an .exe file which hosts shell extentions This way I would only have to distribute one file, and not an external dll
Enjoy!
Marc
|
|
|
|
|
When I use the menu command
Project>Add to Project>Components and Controls
VS opens the gallery window as it should, but it is empty. No ActiveX controls are listed. I checked the path, and it is opening into the 'Gallery' folder. So, in my attempts to figure out what the heck is up, I tried to add a (known) ActiveX control from my C:\WINNT\SYSTEM32 folder. Visual Studio complained that the control was not registered. So, I fired up the ActiveX Control Test Container to check out what controls are registered. The Test Container listed quite a few controls; all of the controls that should be listed in my Gallery window.
Anyway, as I see it, this all proves one thing...the ActiveX controls are all registered correctly on my computer, but for some reason Visual Studio doesn't know how to find them...any suggestions?
I'm running Windows2000, and I have the latest VS update, for all that's worth. Thank you very much for any help, I'd really like to have this functioning like usual.
~Cam Desautels
|
|
|
|
|