|
Could you tell me what are differences between CComBSTR and _bstr_t ?
Thanks in advance.
|
|
|
|
|
|
When do we use CComBSTR or _bstr_t ?
Thank you.
|
|
|
|
|
microsoftcertificate wrote:
When do we use CComBSTR or _bstr_t ?
Depending on Situation!
CComBSTR use ATL.dll and _bstr_t use msvcrt.dll
anyways _bstr_t is always better as it's come after CComBSTR and Still in process of upgradation!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Hi
I am working with a win32 application. I am drawing 4 ellipses in a line on the window. When I draw the second ellipse, I want the first ellipse to be erased on the window and so on..i.e at a time I should see only one ellipse moving on the window in a line.
I am doing the painting in on WM_PAINT handler
I tried using InvalidateRect(NULL, rect, FALSE), it worked but the background drawing which was there on the window initially is getting erased, and the program is going into infinite loop.
Can anyone please give me some suggestions on this?
Thanks
osi-sys
|
|
|
|
|
I really think you are doing too much in your paint routine. The animation calculations should be left outside of your paint routine. Keep the painting very simple.
Your paint loop should only be concerned with painting the single 'current' ellipse.
Also, it can take care of erasing the location of the 'previous' ellipse if you want. Disabling background erasing might reduce your flicker.
Another option is to draw to a memory device context and blit that to the screen during your painting. This will reduce your flicker. And you can erase into the memory DC the old ellipse (an operation that will NOT be visible ont he screen), draw into it the new ellipse, and blit to the screen, then repeat.
|
|
|
|
|
How to enlarge image with antialiassing?
|
|
|
|
|
Hi,
I have coded a chat app. Server-Client based.
Everything worked fine. And suddenly I cant send a normal message anymore, which worked before.
What it does:
The client connects to the server and sends its name, which works. I get all contacts, and see them in my buddylist.
But if I want to send a message to one of the users (which goes to the server first), I get the above mentioned error.
This one means, that I am trying to send the message with a socket, which is no socket?!
But the socket is ok, it has a number, I mean, I get contacts through it etc.
I declared it globally cause I need it very often.
The message I want to send is ok, the string length is ok.
Whats wrong there?
I am coding in VC++6 without MFC.
here my little codesnippets:
/*** Creating socket ***/
if(WSAStartup(MAKEWORD(1,1), &wsaData) != NULL)
return(error(hDlg, "Cant initialize Winsock!"));
if((sock_clnt = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET)
return(error(hDlg, "Cant create local socket!"));
if((phostent = gethostbyname(ip)) == NULL)
return error(hDlg, "Cant get host by name!");
memcpy((char FAR *)&(sockin_clnt.sin_addr), phostent->h_addr, phostent->h_length);
sockin_clnt.sin_family = AF_INET;
sockin_clnt.sin_port = htons(port);
if(connect(sock_clnt, (SOCKADDR *)&sockin_clnt, sizeof(sockin_clnt)) == SOCKET_ERROR)
return error(hDlg, "Cant connect!");
/*** Here the problem call: ***/
int test = 0;
int test2 = 0;
test2 = strlen(msg2srvr);
if((test = send(sock_clnt, msg2srvr, test2, 0)) <= 0)
{
test = WSAGetLastError();
error(hDlg, "Cant send message!");
}
/*** Socket declaration before main function (globally): ***/
SOCKET sock_clnt;
Thats it. I really hope you can help me. Such errors are so annoying...
EDIT: What I just saw: The value of the socket from the client, changes between sending name at the beginning and sending a message when pressing the send button. Is that normal?
I Just connected to the destination socket, and run a thread with an endless loop receiving data with recv(). And if user presses the send button, it sends data through the same socket with send(). This is how it should work, right?
DKT
|
|
|
|
|
sock_clnt should never change!!!
Check your code if any line changes the value of sock_clnt.
Don't try it, just do it!
|
|
|
|
|
Yes thank you! That was it!
So stupid: The worst thing a coder can do, is to define an array with size 10 and then try to write something in array[10]... Unfortunatly the socket was defined directly after the array, and got overwritten... börks...
Thank you!
DKT
|
|
|
|
|
How can I build a driver in Visual C++, what are project settings? Please give me a simple way to achieve it.
|
|
|
|
|
|
The easiest way is to use the build tool (see DDK) to compile it.
Don't try it, just do it!
|
|
|
|
|
I find all the ways to create avi file are from sequence bitmap files, can avi created from sequence jpeg files?
if it can, how can I do the program step by step?
I am a freshman in video...
thanks
|
|
|
|
|
Search msdn.microsoft.com for AVIFile Functions and Macros
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
|
I can't figure why the following matrix multiplication isn't working. Can someone please help me?
<br />
<br />
#include <math><br />
#include "stdafx.h"<br />
#include <iostream><br />
using namespace std;<br />
<br />
double theta, phi, t, p;
double lambda1 = 0.5;<br />
double lambda2 = 2;<br />
double a11,a12,a21,a22,d11,d13,d31,d33;<br />
const double pi = 3.142857;<br />
const int rows = 3;<br />
const int cols = 3;<br />
<br />
void mult(double *fr_array2);<br />
<br />
<br />
double dip_array [3][3] = {0}; <br />
<br />
double azim_array [3][3] = {0}; <br />
<br />
double lambda_array [3][3] = {0}; <br />
<br />
double r_array [3] = {0};<br />
<br />
double fr_array [3][3] = {0}; <br />
<br />
double fr_array2 [3] = {0}; <br />
<br />
<br />
<br />
double a(double p)<br />
{<br />
d11 = cos((p*pi)/180);<br />
return d11;<br />
}<br />
<br />
double b(double p)<br />
{<br />
d13 = -1*sin((p*pi)/180);<br />
return d13;<br />
}<br />
<br />
double c(double p)<br />
{<br />
d31 = sin((p*pi)/180);<br />
return d31;<br />
}<br />
<br />
double d(double p)<br />
{<br />
d33 = cos((p*pi)/180);<br />
return d33;<br />
}<br />
<br />
<br />
double e(double t)<br />
{<br />
a11 = sin((t*pi)/180);<br />
return a11;<br />
}<br />
<br />
double f(double t)<br />
{<br />
a12 = cos((t*pi)/180);<br />
return a12;<br />
}<br />
<br />
double g(double t)<br />
{<br />
a21 = -1*cos((t*pi)/180);<br />
return a21;<br />
}<br />
<br />
double h(double t)<br />
{<br />
a22 = sin((t*pi)/180);<br />
return a22;<br />
}<br />
<br />
<br />
void printarray (double arg[][3]) <br />
{<br />
for (int i=0; i<rows; i++)
{<br />
for (int j=0; j<cols; j++)
cout << arg[i][j] << " ";<br />
cout << "\n";<br />
}<br />
}<br />
<br />
void printarray2(double arg[]) <br />
{<br />
for (int i=0; i<rows; i++)
{<br />
cout << arg[i] << " ";<br />
cout << "\n";<br />
}<br />
}<br />
<br />
<br />
<br />
<br />
<br />
int main(int argc, char* argv[])<br />
{<br />
<br />
cout<<"ANISOTROPY MODELLING.\n";<br />
cout<<"\nPlease enter a real number between 0 and 360 for the azimuth angle, theta, then press the 'Enter' key.\n\n";<br />
cin>>t;<br />
<br />
cout<<"\nPlease enter a real number between 0 and 360 for the dip angle, phi, then press the 'Enter' key.\n\n";<br />
cin>>p;<br />
<br />
a(p);<br />
b(p);<br />
c(p);<br />
d(p);<br />
e(t);<br />
f(t);<br />
g(t);<br />
h(t);<br />
<br />
double dip_array [3][3] = {{d11,0,d13},{0,1,0},{d31,0,d33}}; <br />
<br />
double azim_array [3][3] = {{a11,a12,0},{a21,a22,0},{0,0,1}}; <br />
<br />
double lambda_array [3][3] = {{lambda1,0,0},{0,1,0},{0,0,lambda2}}; <br />
<br />
double r_array [3] = {4,8,3.94};<br />
<br />
<br />
<br />
cout<<"\nThe dip array is:\n";<br />
printarray(dip_array);<br />
<br />
cout<<"\nThe azimuth array is:\n";<br />
printarray(azim_array);<br />
<br />
cout<<"\nThe anisotropy array is:\n";<br />
printarray(lambda_array);<br />
<br />
cout<<"\nThe original range array is:\n";<br />
printarray2(r_array);<br />
<br />
<br />
mult(fr_array2);<br />
cout<<"\nThe final range array is:\n";<br />
printarray2(fr_array2);<br />
<br />
<br />
<br />
return 0;<br />
}<br />
<br />
void mult(double *fr_array2)<br />
{<br />
for(int j=0;j<cols;j++)
{<br />
for(int i=0;i<rows;i++)
{<br />
fr_array2 [j] += r_array[i]*azim_array[i][j];<br />
}<br />
}<br />
}
For whatever value of theta or phi I enter, the final range array consistently reads '0' which shouldn't be. What am I missing???
|
|
|
|
|
Anybody is having LSB Insertion algorithm? Any code in VC++ for the algorithm?
|
|
|
|
|
That kind of question is not really funny!!!!
Search Google!
Don't try it, just do it!
|
|
|
|
|
Hi...
I am having a problem on coverting Bitmap image to IplImage format.Is there
is any OpenCV function to convert it?Or will u please help me with any other way of Conversion..
with a lots and Lots of Hope
Regards,
Hari
|
|
|
|
|
we need a code to take a poto by using a web cam
|
|
|
|
|
|
hi ,
I am trying to change BackColor of MS CommandButton from Thread. But it is giving me Exception.
code of Thread is :
UINT mainThread(LPVOID param)
{
while(!killThread)
{
if(yes)
{
try
{
yes = FALSE;
dlg->m_jbutn.SetBackColor(0x0000ff00);
//dlg is a ptr to dialog (same as 'this')
}
catch(...)
{
MessageBox(NULL,"Exception","Error",NULL);
}
}
Sleep(500);
}
return 0;
}
/**********************/
m_jbutn.SetBackColor(0x0000ff00);
this line works fine outof Thread. So why it is not working in Thread.
|
|
|
|
|
You can only update a GUI control from the same thread that created it. You'll have to send a message to the thread to tell it to update the button.
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,
Does anyone know if it is possible to set up DMA to transfer data between two memory locations within my C++ application, so that I would use CPU for other calculations while transferring data with no CPU involvement.
Cheers,
Vitaly
|
|
|
|
|