Writing Installers
Hello
I need to write an installer that would 'unpack' and install a file in a
pre-defined directory and an executable file that itself is an installer and
that file would start installation also. Here is what I mean:
FileX.exe contains FileY.exe and FileZ.some_extentsion
User runs FileX.exe and FileY.exe starts installation and after it's done
FileZ.some_extension gets copied in some othe dierectory. Can this be done
using VC++ 2005 Express Beta? Thank you.
Victor. Tag: dad Tag: 246752
GIF question
hey all,
i use ImageSource (www.smalleranimals.com) so i can read, and resize JPG's
in my app, which i would recommend 100% for anyone looking for the same.
but they do not work with GIF format, i believe because of the whole patent
issue. what i am looking for then, is a library i can use that reads GIF
files. all i need to do is open GIF files. heck, if i can open them into
RGB format, then i can still use ImageSource to do the rest, resize, add
transparencies etc.
so if anyone knows of a decent library, please let me know.
thanks!
daniel Tag: dad Tag: 246751
dynamic array
Hello,
(Visual Studio 6.0 - C++ : Console win32 application).
Can I declare an array which I don't know it's length on first time,
but I want to reference it as an array (not linked table with pre & next).
i.e :
double myLongArray[1000]
...
and suppose somewhere in the code - the size of myLongArray is 1002 -
can I change its size on runtime ?
Thanks :) Tag: dad Tag: 246742
MDI system menu issue
Hello
I have an issue with MDI child windows - they work fine apart from the fact
that when there is only one child, and it is maximized, it doesn't get a
system menu (i.e. minimize, restore, close) in the top right, and it doesn't
get one on the left either. However, when I create another one, they appear.
But when I create a third, I get *two* system menus on the right and *two*
on the left, one next to the other!
Any ideas what's going wrong? Tag: dad Tag: 246741
do strcat in VC console application
Hello,
I am trying to put 2 strings together into one
(i.e string1 is "ab", and string2 is "bc" the result is "abbc").
In Visual C++ 6.0 - Console application :
How can I do that ?
Need sample code, please.
(I have tried using the function strcat - but compiler doesn't know this
function)
Thanks :) Tag: dad Tag: 246731
help in this string concatenation
Hi,
I am new to programming. I am trying to implement string concatenation. I
use VC++. What's wrong with the following program?
----
#include "stdafx.h"
int main(int argc, char* argv[])
{
char *s = "i love you";
char *t = "more than anything";
while (*s != '\0')
s++;
while (*s++ = *t++)
;
printf("%s\n", s);
return 0;
}
---
it always gives me segmentation fault.
Could anyone help me out?
Thanks a lot,
krm Tag: dad Tag: 246730
read elements from file
Hello,
In console application :
Suppose I have a line in the file, that looks like :
a b c 123 aa bb cc
Can I read from the file,
that each single read, read each element.
(I mean : the first read will read "a", second will read "b", third will
read "c", and so on "123", "aa", "bb", "cc" ...)
Thanks :) Tag: dad Tag: 246729
handling text files
Hello,
In Microsoft Visual C++ 6.0 :
(Console Application).
I want to read and write from/to text file.
How can I do that ?
Need sample code please.
Thanks :) Tag: dad Tag: 246727
Binary Compatibility Question
We have an application that was written using VS6. It uses a number of DLL
type extensions and we need to write a new extension. We no longer support
VS 6 in our development lab and would like to know if a DLL (written in "C")
and built in VS.NET 2003 will be compatible with the VS application.
Thanks,
Sid.
--
Sid Price's Software Tools.
http://www.Softtools.com Tag: dad Tag: 246704
dynamic_cast is shite!
dynamic_cast doesn't return the correct values: e.g. in my project I have a
lot of classes, say A, B, C, D - D being the most derived, A being base - if
I put printf(this) in the constructors of them they all get different
values, e.g.
A will be 0x12fec0,
B will be 0x12fec4,
C will be 0x12fec8,
D will be 0x12fecc, ..etc.
I thought this was supposed to happen, but if I have an A* called "pa"
(knowing myself that it is also a D*)
if I do
void test(A* pa)
{
D* pd = dynamic_cast<D*>(pa);
// then d ends up as 0x12fec0, NOT 0x12fecc as I was hoping!
}
I tried to build a test project to demonstrate but in that all the
constructors printed the same values! Help!
And yes I have got multiple inheritance, I have also got virtual
inheritance. Tag: dad Tag: 246698
GetFileVersionInfo()
I am trying to get various information about the version of a file in order
to determine that it is the correct file. I have one working implementation,
but I also need to generalize the code a bit in order to use it in a related
project.
The generalized code works exactly the same way as the non-generalized code
with a couple exceptions, but I am running into an error with the
GetFileVersionInfo().
Here's a sample:
INT Validate(std::string _file, lpData _info)
{
LPVOID Data;
DWORD dwLength;
DWORD dwEmpty;
dwLength = GetFileVersionInfoSize(_file.c_str(),&dwEmpty);
if (!dwLength) return -1;
Data = (LPVOID) malloc(dwLength+1);
if (!Data) return -2;
memset(Data,0,dwLength+1);
if (!GetFileVersionInfo(_file.c_str(),NULL,dwLength,&Data))
{
free(Data);
return -3;
}
...
}
The lpData is a structure containing the information I want to verify about
the file. My problem is that the pointer is no longer valid after I call the
GetFileVersionInfo(). I checked at run-time by watching the pointers - the
'Data' and '_info' pointers are valid before I call it, but then when it
returns (it does not go into the body of the if-block), the values are
invalid and cause a crash. E.g. the following:
Before After
Valid Invalid
_info = 0x0012f2b4 --> 0x00050000
Data = 0x00fd7be0 --> 0x0034037c
As I said before, I have another version that works just fine. Am I doing
something wrong? I pretty much copy-pasted the code.
TIA, Tag: dad Tag: 246694
Reading the system time
Hi,
Is there a way to read the time so that:
1. If the PC is connected to the Windows Server (NT/2000 or 2003) then read
the server time.
2. If the PC is a thin client and connected to the server through the Citrix
Server then read the server time.
3. If the PC is NOT connected to the Windows Server (NT/2000 or 2003) then
read the local time.
Thanks.
Regards,
Sandford Tag: dad Tag: 246677
Linking error when using multiple forms and #include<afxinet.h>
Hello!
I am developping a Visual C++ .NET multiple forms application, which
uses FTP connection. When I use more than one form, and include the
<afxinet.h> library (necessary for FTP connection), the linker errors
occur:
error LNK2005: "void * __cdecl operator new(unsigned
int)"(??2@YAPAXI@Z) already defined in LIBCMTD.lib(new.obj)
error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z)
already defined in LIBCMTD.lib(dbgdel.obj)
fatal error LNK1169: one or more multiply defined symbols found
In order to be clearer, I'll tell the simple steps to create the
error: I create a Windows Form C++ .NET application; add a new form
(add element->new form); simply include the <afxinet.h> in the Form1.
Ok, if you try to run the application, it will. Now, just close the
Visual Studio, open everything again, do a NEW compilation, and try to
run. (!!!) That's the error! That's why I think it could be a bug
of the Visual Studio...
Thus, I can just work with FTP connection and only ONE form. We tried
the MSDN help, that tells to ignore the library (LIBCMTD.lib), but this
causes other link errors. We tried everything we could.
If somebody could help me anyway I thank very much. Tag: dad Tag: 246674
Need help in Including/converting C files in C++ project
Hello,
I've a few C files in hand containing functions that can be used to
convert a string into MD5 hash string. When I tried to include the c sources
and header files to the project, a lot of errors and warnings comes out.
The c files can be compiled and run successfully when placed in a
standalone project. (with "Project Properties"->"Advanced"->"Compile to" set
to "C executables" of course, and compile option "-DMD=5" to specify the MD
marco)
So I think the sources are Okay.
Would anyone please give me a pointer on how to "include the files in
C++ project"/"convert these C files to C++ sources"?
A second question is: If I included the files, would it be right to just
specify the "-DMD=5" in the project properties, or I should specify it
elsewhere?
Thanks a lot.
Regards,
Lau Lei Cheong
--
If you want to mail to me, please replace all instance of "e" to "a" in my
email address. Thank you.
Sorry for any inconvience caused, but there's many spam-mailers. Tag: dad Tag: 246653
switching stdout to a file
/* The MSDN Library 10/2001 gives this example for the use of dup()/dup2()
to make "stdout" refer to a program-determined file and then restores it
NOTE: All error checking deleted for "clarity" Also, the type and
arguments
of main are not proper either (that's the way it was there) */
#include <io.h>
#include <stdlib.h>
#include <stdio.h>
void main( void )
{
int old;
FILE *new;
old = _dup( 1 ); /* "old" now refers to "stdout" */
/* Note: file handle 1 == "stdout" */
new = fopen( "data", "w" );
/* stdout now refers to file "data" */
_dup2( _fileno( new ), 1 );
puts( "This goes to file 'data'\r\n" );
fclose( new );
/* Restore original stdout */
_dup2( old, 1 );
}
/* BUT I'd like to know what's wrong with using this method instead */
void main(void)
{
FILE *savestdout = stdout;
stdout = fopen( "data" , "w" );
...
fclose( stdout );
stdout = savestdout;
}
TIA
Norm Tag: dad Tag: 246649
MIDI question
When I play a MIDI file with Windowsmedia player, and at the same time
record on "stereomixer" with Audio Recorder, it records the audio of the
midi to wav. When I then play the wav it sounds significatly worse than the
original Midi. Any ideas why? It might be a problem of my sound card.
thanks Tag: dad Tag: 246645
EARN $$$ SEARCHING THE NET IN GOOGLE(READ BODY)
You want to gain much money? So do I!join with me then! That is thus,there is sites that pay for each research in google. This consists of making 40 research per $0,80 day and receiving cent. Or either, to the end of the month they make 25. If to join a friend, and if it to make the 40 research per day and the 25$ to the end of the month. Raisins to gain 50$ (25$ yours and 25$ of your friend). 1º - They have to arrange a paypal account, that is gratuitous, for where the owners of the sites order the money day 14 of each month. For this they visit http://www.paypal.com, sign up, personal account, are enrolled and they do not need for your credit card, becouse having account then gives to make the transference to your account (when to appear, this cancel and thats it ') I currently use 2 sites, I go to leave the sites here but they make the max to obtain $. After confirming the account in the paypal here, they are register: - http://netbux.org/?r=68890 (opens the site, and in low it has to register, are register and such, in the paypal email, put the mail that you have registered before in www.paypal.com. After making signup, go to have one link similar to the from above one but to different numbers. They use this link to make the research. They can control the $ has accumulated in low in button "Stats".) - http://pay-pup.com/?r=36073 (Same procedures from above) LETS GO TO MAKE SOME $$$!
Follow these easy steps:
1) Sign up and register here:http://netbux.org/?r=68890
2) Login and begin searching on Google or your prefered search engine!
3) Do this everyday and tell your friends to make even more money!
Do the same steps for pay-pup
http://pay-pup.com/?r=36073
Note: Netbux works same way put you can earn 80 cents a day insted of $1.00
How Pay-Pup Works
At Pay-Pup, we pay our members to search the internet. There are no strings or gimmicks. You simply register with Pay-Pup and you earn money instantly from your very first search. You will earn $0.02 for every search you make for up to 50 paid searches per day, therefore the maximum pay per day for your individual searching is $1.00. Note: A paid search is one that is unique to your other searches, meaning that you will not get paid for searching the same thing twice.
To make things even better, you will also earn $0.02 for every search that your referrals make for up to 50 searches a day as well! Therefore the maximum pay per day for each referral is $1.00. The more referrals, the more money! Upon registration, you will be given a unique referral url (also located in your 'stats' area) that you can give out to your friends, post it on your website, blog, etc. We also have some images that you can use to help advertise online with.
An amazing feature with the referral program is that if someone comes here by way of your referral url, their ip address is recorded and attached to your account so if they close the browser, disconnect (only static ip's), turn off their computer (only static ip's), you will still get credit if they ever return! You only get paid for one level of referrals but you may already see an enormous earning opportunity here.
There really isn't much to it. You search the net and you earn money. You refer your friends and you'll earn even more money. Your member statistics are updated instantly so you can always stay on top of your earned monies, referrals, searches, etc. We pay you at the beginning of every month via PayPal once you have reached $50 or more. Tag: dad Tag: 246634
EARN $$$ SEARCHING THE NET IN GOOGLE(READ BODY)
You want to gain much money? So do I!join with me then! That is thus,there is sites that pay for each research in google. This consists of making 40 research per $0,80 day and receiving cent. Or either, to the end of the month they make 25. If to join a friend, and if it to make the 40 research per day and the 25$ to the end of the month. Raisins to gain 50$ (25$ yours and 25$ of your friend). 1º - They have to arrange a paypal account, that is gratuitous, for where the owners of the sites order the money day 14 of each month. For this they visit http://www.paypal.com, sign up, personal account, are enrolled and they do not need for your credit card, becouse having account then gives to make the transference to your account (when to appear, this cancel and thats it ') I currently use 2 sites, I go to leave the sites here but they make the max to obtain $. After confirming the account in the paypal here, they are register: - http://netbux.org/?r=68890 (opens the site, and in low it has to register, are register and such, in the paypal email, put the mail that you have registered before in www.paypal.com. After making signup, go to have one link similar to the from above one but to different numbers. They use this link to make the research. They can control the $ has accumulated in low in button "Stats".) - http://pay-pup.com/?r=36073 (Same procedures from above) LETS GO TO MAKE SOME $$$!
Follow these easy steps:
1) Sign up and register here:http://netbux.org/?r=68890
2) Login and begin searching on Google or your prefered search engine!
3) Do this everyday and tell your friends to make even more money!
Do the same steps for pay-pup
http://pay-pup.com/?r=36073
Note: Netbux works same way put you can earn 80 cents a day insted of $1.00
How Pay-Pup Works
At Pay-Pup, we pay our members to search the internet. There are no strings or gimmicks. You simply register with Pay-Pup and you earn money instantly from your very first search. You will earn $0.02 for every search you make for up to 50 paid searches per day, therefore the maximum pay per day for your individual searching is $1.00. Note: A paid search is one that is unique to your other searches, meaning that you will not get paid for searching the same thing twice.
To make things even better, you will also earn $0.02 for every search that your referrals make for up to 50 searches a day as well! Therefore the maximum pay per day for each referral is $1.00. The more referrals, the more money! Upon registration, you will be given a unique referral url (also located in your 'stats' area) that you can give out to your friends, post it on your website, blog, etc. We also have some images that you can use to help advertise online with.
An amazing feature with the referral program is that if someone comes here by way of your referral url, their ip address is recorded and attached to your account so if they close the browser, disconnect (only static ip's), turn off their computer (only static ip's), you will still get credit if they ever return! You only get paid for one level of referrals but you may already see an enormous earning opportunity here.
There really isn't much to it. You search the net and you earn money. You refer your friends and you'll earn even more money. Your member statistics are updated instantly so you can always stay on top of your earned monies, referrals, searches, etc. We pay you at the beginning of every month via PayPal once you have reached $50 or more. Tag: dad Tag: 246633
EARN $$$ SEARCHING THE NET IN GOOGLE(READ BODY)
You want to gain much money? So do I!join with me then! That is thus,there is sites that pay for each research in google. This consists of making 40 research per $0,80 day and receiving cent. Or either, to the end of the month they make 25. If to join a friend, and if it to make the 40 research per day and the 25$ to the end of the month. Raisins to gain 50$ (25$ yours and 25$ of your friend). 1º - They have to arrange a paypal account, that is gratuitous, for where the owners of the sites order the money day 14 of each month. For this they visit http://www.paypal.com, sign up, personal account, are enrolled and they do not need for your credit card, becouse having account then gives to make the transference to your account (when to appear, this cancel and thats it ') I currently use 2 sites, I go to leave the sites here but they make the max to obtain $. After confirming the account in the paypal here, they are register: - http://netbux.org/?r=68890 (opens the site, and in low it has to register, are register and such, in the paypal email, put the mail that you have registered before in www.paypal.com. After making signup, go to have one link similar to the from above one but to different numbers. They use this link to make the research. They can control the $ has accumulated in low in button "Stats".) - http://pay-pup.com/?r=36073 (Same procedures from above) LETS GO TO MAKE SOME $$$!
Follow these easy steps:
1) Sign up and register here:http://netbux.org/?r=68890
2) Login and begin searching on Google or your prefered search engine!
3) Do this everyday and tell your friends to make even more money!
Do the same steps for pay-pup
http://pay-pup.com/?r=36073
Note: Netbux works same way put you can earn 80 cents a day insted of $1.00
How Pay-Pup Works
At Pay-Pup, we pay our members to search the internet. There are no strings or gimmicks. You simply register with Pay-Pup and you earn money instantly from your very first search. You will earn $0.02 for every search you make for up to 50 paid searches per day, therefore the maximum pay per day for your individual searching is $1.00. Note: A paid search is one that is unique to your other searches, meaning that you will not get paid for searching the same thing twice.
To make things even better, you will also earn $0.02 for every search that your referrals make for up to 50 searches a day as well! Therefore the maximum pay per day for each referral is $1.00. The more referrals, the more money! Upon registration, you will be given a unique referral url (also located in your 'stats' area) that you can give out to your friends, post it on your website, blog, etc. We also have some images that you can use to help advertise online with.
An amazing feature with the referral program is that if someone comes here by way of your referral url, their ip address is recorded and attached to your account so if they close the browser, disconnect (only static ip's), turn off their computer (only static ip's), you will still get credit if they ever return! You only get paid for one level of referrals but you may already see an enormous earning opportunity here.
There really isn't much to it. You search the net and you earn money. You refer your friends and you'll earn even more money. Your member statistics are updated instantly so you can always stay on top of your earned monies, referrals, searches, etc. We pay you at the beginning of every month via PayPal once you have reached $50 or more. Tag: dad Tag: 246632
Please help me solve it.
Hi,
I try to use the CEdit::SetTabStops(),
....
int nTabStop[]={100*4,20*4,2*4};
m_edit1.SetTabStops(3,nTabStop);
m_edit1.SetWindowText("test01\ttest02\ttest03\ttest04");
...
it can't work at all.
But CListBox::SetTabStops() works well. If you know how to use
CEdit::SetTabStops(), please help me.
Thanks in advance.
Cui Sheng Tag: dad Tag: 246620
To mark randall
To Mark Randall::First of all thanks for replying . Well i wann to kno
the virtual memory layout of the code. and about the assembly cod
suppose i hav e a assembly code i wann to convert it into the exe file
wann to know how t his can happen. As far as i know the the pointe
addres that we mention in t he C++ program are the virtual address
like suppose i say int i;int* i_ptr=&i;Here &i returns the virtua
address of "i" in the code. But if u compile this program and get th
ASM file you can see the registers . I dont think the assembly code i
the ASM file specifies the virrtual addr ess. So perhaps for paging th
ASM code is converted to EXE file. I am not s ure if this is wha
happens. I want to know if it is true. And the stack is not like thi
as you have mentioned. [Function 1 Vars] [Stack Pointer] [Func tion
Vars] [Stack Pointer] [Function 3 Vars] [Stack Pointer] But as far as
know it is like first the invironment varriables are pushed into th
stack. then the global values and then the main and other functions
Well main is replaced by other functions which are found in th
crt0.cpp f ile. And the stack pointers you have mentioned, are the
storing the virtual addr ess or the physical address? If my grammer i
poor sorry
-
DeltaOn
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
----------------------------------------------------------------------- Tag: dad Tag: 246612
In memory layout of the C++ program
To Mark Randall::First of all thanks for replying . Well i wann to kno
the virtual memory layout of the code. and about the assembly cod
suppose i have a assembly code i wann to convert it into the exe file
wann to know how this can happen. As far as i know the the pointe
addres that we mention in the C++ program are the virtual address. lik
suppose i say
int i;int* i_ptr=&i;Here &i returns the virtual address of "i" in th
code. But if u compile this program and get the ASM file you can se
the registers. I dont think the assembly code in the ASM file specifie
the virrtual address. So perhaps for paging the ASM code is converted t
EXE file. I am not sure if this is what happens. I want to know if it i
true. And the stack is not like this as you have mentioned. [Function
Vars] [Stack Pointer] [Function 2 Vars] [Stack Pointer] [Function
Vars] [Stack Pointer]
But as far as i know it is like first the invironment varriables ar
pushed into the stack. then the global values and then the main an
other functions. Well main is replaced by other functions which ar
found in the crt0.cpp file.
And the stack pointers you have mentioned, are they storing the virtua
address or the physical address?
If my grammer is poor sorry
-
DeltaOn
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
----------------------------------------------------------------------- Tag: dad Tag: 246611
what is segment not defined ?
Hi,
I am using edgcc to compile some c++programs..
everything goes smooth...
However when I try to compile programs with objects (any type maybe
int,char* ,class,struct ect) defined OUTSIDE main, compilation error occurs...
as
test.int.c
test.c(48) : warning C4068: unknown pragma
test.c(49) : error C2341: '.CRT$XCU' : segment must be defined using #pragma
dat
a_seg or code_seg prior to use
Kindly suggest what does it mean...
test.c has code outside main as
class X {
public:
int ix;
X(int ii=0) : ix(ii) {}
};
X ox;
int X::*pmi = &X::ix;
X *px = &ox;
main(){...} Tag: dad Tag: 246603
string to int
Hi, All
For String ( not char ) to int, which funtion I can call?
for VB, str(), val ()
for java String.Tovalue(X)
for VC ?
Thank you vrey much.
Best regards,
Boki. Tag: dad Tag: 246598
Can't get VS to convert a dynamic link library to static library.
I have a 'C' project that is a Win32 DLL project that I am trying to convert
to a static library. I removed the all instances of the DLL on my hard
drive to make sure that I was linking with the new static library instead of
running with the DLL.
I am compiling this library VS.NET 2003. I have changed the VC compiler
option under the General tab to Static Library. The project compiles find
and builds the .LIB file as expected. No DLL file is generated either,
which is also what is expected. I am able to link the .LIB file into my EXE
with no errors. However, when I try to run the EXE, I get an error stating
that the DLL file for the library that I built cannot be found. I don't
understand why the LIB file is still trying to run as a DLL instead of a
static library.
I have checked and double checked for any errant files that may be linked
in, and cannot figure out what is wrong. I have checked the DEF file for
any LIBRARY directives. I even checked the RC file for any DLL file
references. I can't see any reason why the thing is still behaving like a
DLL.
Can someone give me any advice on what to do here?
--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
EmailID = varnk
Domain = Diebold.com
----------------------------------- Tag: dad Tag: 246591
Outlook CommandBar
Hi there
IS there a Control that comes with Windows or
VC6 that i can use to reproduce the look of a
"Scrollable Toolbar" ? In other words a Toolbar
that is clipped if it exeeds a pre-defined size and scrolls
with 2 buttons and the ends etc..
I thought of the Outlook CommandBar but i
donc want to worry about what version
of Outlook the user has and weather or not
i can legaly recycle it etc...
thanks. Tag: dad Tag: 246586
Very bad crashes when debugging with Spy++
I have experienced a scenario whereby I experience very bad crashes, when
using Spy++. When this crash occurs, not only one program crashes but the
whole system hangs - even Ctrl+Alt+Del doesn't do anything. The only thing
to do is press the motherboard reset switch. I experience it when debugging
while also using Spy++. I tried to reproduce it using a blank "hello world"
app rather than my own and it didn't do it, so it must be something about my
app, but there are no other symptons of it so it seems strange that it
should only affect Spy++, I wondered whether anyone else had seen it
nonetheless? Also worthy of note is that this still occurs if my app has
only ever had one main thread.
Steps taken to reproduce the crash:
1) Start VS.NET, and run windows application under debugger by starting with
F5.
2) Start Spy++, and spy on the application's window.
3) Close the application. (Closes without exception and returns to the IDE
correctly)
4) Press F5 again (not necessarily having recompiled) to try to start the
app again - and crash!
The app never starts, the system is from that point on doomed, and will
respond to absolutely nothing other than a hardware reset. It doesn't do it
if I close down Spy++ between steps (3) and (4) - I can then start it up
again and continue spying.
My guess is that when spying (as in step (2)), Spy++ has acquired some kind
of low-level hook to the application, and when it closed down, managed to
get its claws into the IDE because it was its parent process and somehow
this has blocked some very low-level function. Tag: dad Tag: 246577
VC++ beginner question
Hello, I am a beginner of C++. I read a book and try the following program
using free VC++ 2003 Toolkit. The code compile successful by VC++ 5 but fail
by VC++ 2003 toolkit. Why? Anyone can help me. Thanks in advance.
Atsushi
#include <iostream.h>
#include <iomanip.h> //for setw() etc
class airtime
{ private:
int minutes;
int hours;
public:
void set()
{ char dummy;
cout<<"Enter time (format 23:59):";
cin>>hours>>dummy>>minutes;
}
void display()
{ cout<<hours<<":"<<setfill('0')<<setw(2)<<minutes;
}
int AirtimeToMins()
{ int imins=hours*60 + minutes;
return imins;
}
}; //end class airtime
void main()
{ airtime t1;
int iminutes;
char choice;
do
{ cout<<"For t1, ";
t1.set();
iminutes=t1.AirtimeToMins();
cout<<"Minutes="<<iminutes;
cout<<"\nDo another (y/n)?";
cin>>choice;
}while(choice != 'n');
} Tag: dad Tag: 246570
Image Name in Task Manager
Hi all,
I have a C++ application, with a long name, sometimes I can see the full
name in Task Manager when it is running,
but some times the short name is displayed in Task Manager.
Can some one explain or point to a document to explain this?
TIA,
JoeZ Tag: dad Tag: 246562
hilite menu
Hi!
I have a popup menu in my aplicattion. There are several items with a bmp
image.
When these items are highlighted moving the cursor over them, the image
appears ugly (the blue highlight bar over the image converts the colors to
the opposite ones).
Are there solutions to this problem? It's important to use only APIs and not
MFC objects.
May be an option to don't covert the image with the highlight?
Thanks
Jordi Tag: dad Tag: 246552
how to permit only one instance of the program to run ?
Hi,
How to permit only one instance of a program to run at any time? I mean ,
the program 1st checks to see the program is already running and if another
instance it is already running exists.
best
bn Tag: dad Tag: 246551
Hi
HI,
winbase.h 'sleep' function contradicts with signatur of 'sleep ' defined in
my library. I have changed the signature of the function in my library header
but not in library code .lib
Will it work...
Also is there any other way I can remove this linkage error ....maybe not
including windows cpp library file which has this sleep function.
Thanks,..
.cpp.a.a Tag: dad Tag: 246547
#using not working ?
Hi,
I am using a simple statement of the form
#using <mscorlib.dll>
however the MS VC++ compiler complains...
"fatal error C1021: invalid preprocessor command 'using'"
Kindly suggest....what is the problem and how do i make it work...
Thanks
a.a.cpp Tag: dad Tag: 246541
Manifest of repro
Right now I am now confronting with the Internal Compiler Error bug of the
VC++ 6.0 compiler :(
How to repro every possible ways that Microsoft has announced in the kb? Is
it a quick long list that I can read and type?
In the kb, they said it could be
1) misuse of pragma (pack,?)
2) using "using namespace" recursively
3) compiling large prototype files
4) and a dozen of poss.
And I've nearly touched all of the above.... :(
Is it recommended to create a console application to repro every possibility
to see what's gone wrong? My compiler VC++ 6.0, yes. pretty old with no SPs, Tag: dad Tag: 246539
remove non empty direcory
Hello,
I would like to know the simplest way ro remove a non empty directory
using VC++ 6.0.
thnks
François Tag: dad Tag: 246538
Where can I write code for event in VC.Net windows application?
I am quite new with VC.Net and am using it to a multi-form windows
application. I found that only one or two events are able to be generated
automatically in code view by double click on these controls. I can write
code for these event function. But I don't know how to create other event
functions in code view. So I have no place to write code to.
Please tell me how to solve this problem, or where I can find some samples.
Thank you in advance for your help. Tag: dad Tag: 246535
Array of class and a pointer to it
Hello,
I defined a class name MyClass.
I would like to define an array of 4 by 8 of that class.
I would like to define a pointer to the array of MyClass.
I tried it with static definition:
MyClass m_MyClass[4][8] ;
I can not seem to find the way to define a pointer to this array?!?!?
I tried also to define it with the new operator but had similar results.
Any ideas how to do it?
Eitan Tag: dad Tag: 246531
Load a ICON in a Button
hello
i've having a bit of a problem with loading a Icon in a Button.
Basicaly I got a Dialog resource with a button on it.
And with the "property bag" of the button i set it to "Icon"
Then I load the icon like so :
( i make sure the button is 16x16)
HWND hbut2 = GetDlgItem(IDC_BUTTON2);
::SetWindowPos(hbut2, NULL, 0, 0, 16, 16, SWP_NOMOVE);
HICON icon = LoadIcon(_Module.GetResourceInstance(),
MAKEINTRESOURCE(IDI_ICON4));
::SendMessage(hbut2, (UINT)BM_SETIMAGE, (WPARAM)IMAGE_ICON,
(LPARAM)icon);
Now for some reason, the button loads the Icon 32x32 =/
I made the icon myself and made sure the Icon is 16x16.
So is it the LoadIcon API that loads the icon as 32x32 or
is it the Button that cannot accept icons smaller then 32x32 ?
ok thanks for you input =] Tag: dad Tag: 246528
Spin Control
hi
I'm using a Spin Control on a dialog resource in VC6 .
Im not using MFC.
I there a documentation on how i can interface with that control
even though im not using MFC ?
thanks. Tag: dad Tag: 246525
issue with the new VC .NET #import for smart pointers
OK. this is my second issue with the new VC .NET #import for smart pointers.
for the following declaration in an ODL
dispinterface IFoo
{
methods:
[id(1)] IDispatch* GetFoo2();
}
dispinterface IFoo2
{
}
I get in VC 6 these wrappers:
_COM_SMARTPTR_TYPEDEF(IFoo, __uuidof(IDispatch));
_COM_SMARTPTR_TYPEDEF(IFoo2, __uuidof(IDispatch));
in VC 7 I get
_COM_SMARTPTR_TYPEDEF(IFoo, __uuidof(IFoo));
_COM_SMARTPTR_TYPEDEF(IFoo2, __uuidof(IFoo2));
The problem is that I am having difficulting utilizing the generated
wrappers because IFoo2 is not returned what is returned is IDispatch. I know
I can access these without the wrappers but that just seems stupid. Probably
I need to make a minor modifications on how I use the smart pointer but I am
at a loss for what that would be.
Any help or insight would be appreciated.
- BAZ Tag: dad Tag: 246504
C/C++ .net forms
I am trying to build a C/C++ .net form that displays data received from a
comm port. I have created a C/C++ .net form project, but I can't figure out
where to place the C/C++ code that runs in an endless loop monitoring the
comm port, recieving a data packet every 5 secs and updating the form. When
the form is closed, I want to close the port handle. I have createdI have
the code to manage the comm port. I've done something similar in a VB
project with "form load". Tag: dad Tag: 246496
How include animated GIF into CEdit ?
I need put small animated gifs (like emoticons) into CEdit control in
place of blinkinh caret.
Thanks for help. Tag: dad Tag: 246492
start off with port progarmming ....
Hi,
I am using the following code to start off with port progarmming ....
int main()
{
int t;
t=_inp(1);
cout<<t;
return 0;
}
but it gives 'Windows priviliged exception'
Kindly suggest....
Thanks
a.a.cpp Tag: dad Tag: 246490
In memory layout of the C++ program
Hi,
I read the common object file format. But i am not pretty sure how
machine language is converted to exe file. How can i generate the
virtual address. I wann to know how the memory layout of a C++ program
in done in memory i.e virtual memory and the physical memory also. With
the VC++ compiler or some other compiler also i can get the assembly
code for that program but how is this program converted to exe file and
why is it converted as a assembly program is directly converted into the
binary code , so why need to convert it into the exe file or other
formats?Can any one suggest some links also.
--
DeltaOne
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------ Tag: dad Tag: 246489
COM - Should interfaces be marshalled when passing between threads
Hi,
My understanding is that you dont need to marshal interface pointers
between threads of a process when they are all in a Multi Threaded
Apartment (all threads in the process call CoInitializeEx(NULL,
COINIT_MULTITHREADED)).
I am getting apparently conflicting advice from some pages - here are a
couple of snippets:
1) From "http://msdn.microsoft.com/msdnmag/issues/1100/wicked/"
Passing a raw interface pointer (a 32-bit address in memory) to another
thread without marshaling it bypasses COM's concurrency mechanism, and
can produce all sorts of undesirable behavior if the sending and
receiving threads reside in different apartments. (In Windows® 2000,
because two objects can share an apartment but reside in different
contexts, it can even get you in trouble if the threads are in the same
apartment.)
2) From "http://support.microsoft.com/?kbid=150777"
Multi-threaded Apartment model (MTA): ... Interfaces are not marshaled
between threads.
Thanks for this and past help,
David. Tag: dad Tag: 246487