|
What's the use of typedefing basic types ?
I'm reviewing some old C code, and there's a lot of typedef like
typedef float *FloatPtr;<br />
typedef float **FloatPtr2D;<br />
typedef float ***FloatPtr3D;<br />
typedef float ****FloatPtr4D;<br />
<br />
typedef unsigned int UInt;<br />
typedef unsigned int *UIntPtr;<br />
<br />
typedef int *IntPtr;<br />
typedef int **IntPtr2D;<br />
typedef int ***IntPtr3D;
and some other variants of the same things; and it's all mixed up in the code, sometimes, declaration use a typedef, but the definition use the full type.
If I need to typedef some basic types to be used all around the application to follow a code guideline, is there a standard way of doing this, in C++ preferable ?
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." (from /.)
|
|
|
|
|
Maximilien wrote:
typedef unsigned int UInt;
typedef unsigned int *UIntPtr;
Now you can write UIntPtr instead of unsigned int* .
Typedefing like this saves a few keystrokes.
Even Microsoft does it: you van write UINT for 'unsigned int ' or BOOL for int .
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
Hi.
I've set a low level mouse and keyboard hooks in my DLL , but for some reason
it slowers my mouse movement ( almost impossible to move ).
Does anyone knows what the problem might be?
Thanks.
|
|
|
|
|
You're not trying to do anything with the mouse (like move it or click it) in the processing of the hook event, are you? ... in fact, could you post what you are trying to do in the hook code?
'--8<------------------------
Ex Datis:
Duncan Jones
Merrion Computing Ltd
|
|
|
|
|
Hi.
No, I'm not trying to move it or anything else.
I just set the hook , and that's it.
Any ideas?
Thanks.
|
|
|
|
|
This is a documented side-effect of installing system-wide hooks. It's both expected and unavoidable.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi.
Can you tell me where is it documented please?
Thanks.
|
|
|
|
|
MSDN: "Hook Procedures"
You should use global hooks only for debugging purposes; otherwise, you should avoid them. Global hooks hurt system performance and cause conflicts with other applications that implement the same type of global hook.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
How could i make an app start up before windows so it can access the partition tables, execute formats, repartition etc?? I mean something like Partitionmagic for example, you choose to delete a partition, like for example your C partition then it does something, u have to reboot and it does the job before windows is fully started (otherwise it cant access it because its protected?). Allthough in Windows 2000 and XP it seems sort of encapsulated, like windows starts but during startup it does the tasks, like where scandisk runs too.
Anyone know how to do this from an application?
Kuniva
--------------------------------------------
|
|
|
|
|
|
is there a way to pack or zap a recordset?
or do i have to create an outside program?
|
|
|
|
|
What do you mean by recordset?
Do you mean database recordset?
Best regards,
Alexandru Savescu
P.S. Interested in art? Visit this!
|
|
|
|
|
yes, i am sorry i am most likely using the wrong wording for vc++. pack and zap are database terms. pack will permently delete all records marked for deletion. zap removes all records from the table.
are there any mfc functions that do the same.
|
|
|
|
|
You could possibly serialize the recordset object, if this is what you mean, I am not sure.
-Nick Parker
|
|
|
|
|
you know that may be what i want to do, but i can not find any documentation on it. what does that function actually do?
and what does it required to be passed?
thanks
|
|
|
|
|
Is this a SQL database? If so, it has built-in stored procedures for just this sort of thing, and more.
|
|
|
|
|
it is a access database being accessed through odbc.
|
|
|
|
|
I'm not as experienced with Access, but I do not know of it having anything internally that will pack a database. If that is indeed the case, you will need to do it manually. Something like:
open database in exclusive mode
create a temporary database
for each row that is not marked for deletion, copy it to temporary database
close the temporary database
close the main database
delete the main database
rename the temporary database
This is a very high-level overview but hopefully you get the idea. You might also want to look at the Compact utility. It works in basically the same way I described above, but no doubt more elegantly!
|
|
|
|
|
that is what i was originally thinking. but that again is what i was hoping to avoid. when you get to large files this function becomes slow.
thank you.
|
|
|
|
|
First of all I am not sure what you mean by marked for deletion? Is there a field in the table that marks the recordset for deletion? If not, then you should check the batch mode.
If there is a field in the table that flags the record as deleted then you should check SetFilter or set_filter functions. This way only the records that need to be deleted will be accessed (you can specify your own filter criterias). If your database allows you to delete multiple records at once then you can go ahead and do that. If not, then you should iterate through each element and delete them.
How are you accessing the database? ODBC, ADO, etc.?
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
I'm writing a very simple console program to solve a very specific problem i'm having:
I have two computers set up in a home network configuration. One is newer and one is older. I have my printer plugged into the older one (becuase of space). However, if the older comp is not on and I run Word i get this error (that references the printer driver) that crashes word. I've called customer support for the printer and the vendor but they are clueless (go figure). So I've decided to write a simple fix for this prob. However, I haven't written code in a year (no so much a prob) and there are some things i've never had to do in a prog that i'm going to have to do for this:
-start a process (the printer software) from within my prog...I'm probably going to use CreateProcess()
-end a process from within my prog
-to check and see if a process is running (the printer software)...wishful thinking tells me someone has a function that does this and will simply return a bool value
-to check if the other computer is connected to the network...I figured the easiest way to do this would be to ping the other computer and use the ping as the deciding factor, but how do you get a ping from within your own prog?
Any help on this would definently be great.
Thanks
PS I'm going to hide the prog using parameters from CreateProcess() because creating a service would be too much of a hassle.
|
|
|
|
|
What operating systems are you using? What kind of printer are you using? What version of word?
:wq! wrote:
ping the other computer and use the ping as the deciding factor, but how do you get a ping from within your own prog?
Yes this is probably the best way. I think there are a few examples that put a GUI on ping on this site.
I was thinking why not get a 1 port network printserver connect that to the printer and leave it on all the time. I have used them in the past. You should be able to buy one for less than $50 on ebay.
John
|
|
|
|
|
I'm writing the code in WinME (ick) and putting it on a WinXP box. This is kind of why I want to keep the program really simple.
|
|
|
|
|
I fogot: the printer is an hp 5550...HP technical support just told me that is was a Word prob and told me to call the vendor.
|
|
|
|
|
The reason why I asked these questions is that I have never experienced this myself and I have (as a system admin) seen many different printer configurations. I don't see why the printer driver would cause an application to crash but a badly written driver could.
John
|
|
|
|