|
BoscoBill wrote: this approach seems a bit torturous and involves a lot of overhead.
You don't have much choice.
Switch to VS .NET or VS 2005+ and it will be much easier, since you'll have
managed support built in to the C++ language.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Has anyone successfully used the Regasm approach in production?
That seems like it may be workable.
|
|
|
|
|
BoscoBill wrote: Has anyone successfully used the Regasm approach in production?
I have no idea. It's still a viable solution, especially if you're good with COM
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi
I'm facing some problem in standard MFC application. In my application, I'm able to run only 3 insatnces of my application simultaneously.That is, i'm able to open only three login screens at the same time, but I dont want this limitaton. I'm currently working in Windows XP. However, when I ran my application in Windows NT, only 4 instances can ber run at a time. When I tried to open it fourth time in Windows XP, it gets crashed at the following line of code.
//winfrm.cpp
BOOL CFrameWnd::Create(LPCTSTR lpszClassName,
LPCTSTR lpszWindowName,
DWORD dwStyle,
const RECT& rect,
CWnd* pParentWnd,
LPCTSTR lpszMenuName,
DWORD dwExStyle,
CCreateContext* pContext)
{
HMENU hMenu = NULL;
if (lpszMenuName != NULL)
{
// load in a menu that will get destroyed when window gets destroyed
HINSTANCE hInst = AfxFindResourceHandle(lpszMenuName, RT_MENU);
if ((hMenu = ::LoadMenu(hInst, lpszMenuName)) == NULL)
{
TRACE(traceAppMsg, 0, "Warning: failed to load menu for CFrameWnd.\n");
PostNcDestroy(); // perhaps delete the C++ object
return FALSE;
}}
m_strTitle = lpszWindowName; // save title for later
if (!CreateEx(dwExStyle, lpszClassName, lpszWindowName, dwStyle,
rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
pParentWnd->GetSafeHwnd(), hMenu, (LPVOID)pContext))
{
TRACE(traceAppMsg, 0, "Warning: failed to create CFrameWnd.\n");
if (hMenu != NULL)
DestroyMenu(hMenu);
return FALSE;
}
return TRUE;
}
Can anybody please advise on this?
Chirag Kalra
Chirag Kalra
|
|
|
|
|
Hi,
I am trying to use the WinAPI function MoveFileEx to move an entire folder, but can't get the formats of the paths correct. Are trailing backslashes required on either or both paths? Are *.* required? I think I have tried every conceivable combination. Can someone please tell me what I am doing wrong?
Thanks
|
|
|
|
|
I think it will be better if you stablish the path, and then you iterate with the individual file names.
The backslashes should be needed in the string,
CString szFile1 = "C:\\MyFolder\\MyFile1.ext"
CString szFile2 = "C:\\MyFolder\\MyFile2.ext"
...
And I mean:
CString szPath = "C:\\MyFolder\\";
use FindFirstFile (...)
while (FindNextFile (...) can be used)
Get the name and move the file
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
plz help me to complation this code :
#include<iostream>
using namespace ::std;
class calculator
{
private :
int x , y ,z
public :
}
|
|
|
|
|
eerrikkaa wrote: }
There's your hint.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
There should be be semicolons as shown below:
class calculator
{
private:
int x, y, z;
public:
};
Steve
|
|
|
|
|
eerrikkaa wrote: #include
using namespace ::std;
class calculator
{
private :
int x , y ,z
public :
}
The answer will help you to compile the code., but nothing will run.
you have to include void main() in your program to see something running.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hey all,
I asked this question before, but (surprisingly) did'nt get any replies.
Let me rephrase it in a bit different way..
I want to implement a SMTP server in C++, but dont know where to start from.
I looked up in internet for any tutorials or any already existing SMTP server classes,
but couldnt find any of them. The only thing that I found were classes for SMTP
clients, i.e. for sending emails, but that is not what I need as you can see.
I would really appreciate any helpful comments regarding this matter.
Thanks.
|
|
|
|
|
Hello everyone,
I have a long array (char*) and I need to check which bit is the first bit whose value is 1.
I have two ways to implement,
1. Iterate each byte, then iterate each bit in each byte one by one;
2. Iterate each byte, and check whether the value of the byte itself is non-zero, if yes, then iterate each bit in the byte to find which bit is the first bit which is set to 1, or else skip this byte and continue to iterate next byte.
I think (2) is always faster, right? But I do not know why (2) is faster since it is just my personal estimation without any concrete basis analysis.
thanks in advance,
George
|
|
|
|
|
George_George wrote: I think (2) is always faster, right?
Only because it skips bytes with a value of 0 . If your input set had no such values, there would be no difference.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks DavidCrow,
I agree. If the character buffer array does not have a long heading 0-value bytes, there should not be any differences.
regards,
George
|
|
|
|
|
2 will be much faster, for data which is likely to have a lot of 0 bytes.
and, as long as you're checking for 0, you might as well test for 255 (all bit set), too.
and, that brings up a question: is there a way to test all the other bit patterns a byte can have without having to shift and mask each one ?
the answer is Yes.
int look_up_table[256];
look_up_table[0] = -1; // no bits set
look_up_table[1] = 0; // first bit set is bit 0
look_up_table[2] = 1; // first bit set is bit 1
look_up_table[3] = 1; // first bit set is bit 1
look_up_table[4] = 2; // first bit set is bit 2
look_up_table[5] = 2; // first bit set is bit 2
look_up_table[6] = 2; // first bit set is bit 2
look_up_table[7] = 2; // first bit set is bit 2
look_up_table[8] = 3; // first bit set is bit 3
...
look_up_table[255] = 7; // first bit set is bit 7
then, to see which bit is set:
int first_bit_set = look_up_table[byte_to_test];
that will outperform any shift-and-mask algorithm probably by an order f magnitude.
|
|
|
|
|
Thanks Chris Losinger,
Looks like you have smarter ways to solve my question. I am always interested to learn better ideas. I have studied your idea for a while and I do not quite understand why you have two value 1? four value 2?
Especially I do not quite understand this,
int first_bit_set = look_up_table[byte_to_test];
Could you show me some samples about how it works? Sorry for my stupid and confusion.
Chris Losinger wrote: int look_up_table[256];
look_up_table[0] = -1; // no bits set
look_up_table[1] = 0; // first bit set is bit 0
look_up_table[2] = 1; // first bit set is bit 1
look_up_table[3] = 1; // first bit set is bit 1
look_up_table[4] = 2; // first bit set is bit 2
look_up_table[5] = 2; // first bit set is bit 2
look_up_table[6] = 2; // first bit set is bit 2
look_up_table[7] = 2; // first bit set is bit 2
look_up_table[8] = 3; // first bit set is bit 3
regards,
George
|
|
|
|
|
binary 0 = 00000000
binary 1 = 00000001 : first bit set is bit 0
binary 2 = 00000010 : first bit set is bit 1
binary 3 = 00000011 : first bit set is bit 1
binary 4 = 00000100 : first bit set is bit 2
binary 5 = 00000101
binary 6 = 00000110
binary 7 = 00000111
binary 8 = 00001000 : first bit set is bit 3
binary 9 = 00001001 : first bit set is bit 3
binary 10= 00001010 : first bit set is bit 3
etc.,
up to 255 = 11111111 : first bit set is bit 7
so, look_up_table is an array of values that track the first bit set for each value a BYTE can hold.
if you want to know the first bit set in 10, for example:
int first_bit_set = look_up_table[10];
that gives you...3
|
|
|
|
|
Cool, Chris Losinger!
I am clear now.
regards,
George
|
|
|
|
|
See here.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
You always have good stuff, DavidCrow! Cool!
regards,
George
|
|
|
|
|
Hello, I've been searching on the net but I just cannot find the right thing to do to get that working.
What I want is, to basically create an image from a folder, containing the folder's contents.
Then, I'd just Mount the file in my program, and read all the images / Music files / Etc, from there, instead of from a folder.
It's hard to explain, pretty much, because I don't really know how this is called.
I'd love to hear some reply on this one
Thanks in advance.
|
|
|
|
|
I imagine you are trying a type of "backup".
Take a look into the articles, search for Compression.
I can imagine to do it like:
Supposing a list of structs, each of them with a CString for path/name, other parameters you want to save, and a BYTE* pBuffer with variable length
1) Going to Folder and get the first file complete name (or path)
2) Save path and name into a CString
3) Open the file in binary, get the length, allocate a buffer with that size, and read the contents into a buffer
4) Save it in one struct
5) Get to next file in folder
6) ....
At the end... you can use the CArchive to serialize the data into a file with the extension you want to use, compressing or not the datas.
Afterwards you would be able to read your file, extract the first parameter (the string with name/path) and list them in your app, if you want to extract one, you select the complete object, and create a new file with the binary contents you previously saved.
Hope it helps
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
hi all..
need help again!
i have a service running using a user which is part of the administrator group... i am doing DCOM and the service encounteres access denied error when trying to connect to the remote machine. however when i run the service using local system account everything works fine. can someone please explain to me the difference between an administrator and the local system account and how to resolve this problem. thanks for the help!
not so newbie
|
|
|
|
|
Dear All
How can i get all process which is connecting to internet and geting its download & upload rates for my PC not any remote PC
then how i put a control to such rates
for example let IE max. download rate is 20K ,preventing it to download with a rate more that
NOTE: without using SNMP
Thanks
bye
|
|
|
|
|