|
Hi all
I want to copy some file(like .dll ,.exe etc) from some perticular location and paste to another location and i m using Shellexecute but it is not working. so can u help me out get it done.
shellexecut(m_hwd, "copy", "Path of the source directory","path of the destination directory",NULL,NULL);
Thanks in advance
RYK
|
|
|
|
|
|
Here is the code:
<br />
#define PP_CAT(a,b) PP_CAT_(a,b)<br />
#define PP_CAT_(a,b) a##b<br />
<br />
#define PP_STR(s) PP_STR_(s)<br />
#define PP_STR_(s) #s<br />
<br />
<br />
class CNamedTreePropertyBase<br />
{<br />
public:<br />
CNamedTreePropertyBase() : name(0), pParent_(0) {}<br />
CNamedTreePropertyBase(const TCHAR * const Name, <br />
CNamedTreePropertyBase *pParent) : name(Name)<br />
, pParent_(pParent) {}<br />
<br />
const TCHAR *const name;<br />
virtual const TCHAR const *GetName() const = 0;<br />
CNamedTreePropertyBase *pParent_;<br />
};<br />
<br />
<br />
#define NAMED_PROP(Type, Var, InitialVal, pParentProp) \<br />
class PP_CAT(tag, Var) : public CNamedTreePropertyBase \<br />
{ \<br />
public: \<br />
const TCHAR * const name; \<br />
Type value; \<br />
PP_CAT(tag, Var) () : name(PP_STR(Var)) \<br />
, value(InitialVal) \<br />
, CNamedTreePropertyBase(name, pParentProp) {} \<br />
const TCHAR const *GetName() const {return name;} \<br />
} Var; \<br />
<br />
<br />
struct A<br />
{<br />
NAMED_PROP(std::string, prop, _T("some value"), 0);<br />
NAMED_PROP(std::string, child_prop, _T("some value"), reinterpret_cast<CNamedTreePropertyBase*>(&prop));<br />
};<br />
The MSVC 6.0 compilier, and it issues an error:
E:\Projects\Sources\TestVarName_1.0_question\TestVarName.cpp(56) : error C2440: 'reinterpret_cast' : cannot convert from 'class A::tagprop A::*' to 'class CNamedTreePropertyBase *'
There is no context in which this conversion is possible
How can it be possible to convert the pointer correctly?
|
|
|
|
|
|
Hello everyone,
There are two scale parameter in perfmon tool and I am not sure how to calculate the real value of working set bytes from the two scale parameters. Could anyone help please?
The two scale parameters are,
1. At the bottom of perfmon main screen, there is a scale column
2. Properties dialog --> Graph Tab --> Vertical Scale
If I set Vertical Scale max to 1,000,000 and the scale column for working set is 0.0000100, and the current value of displayed working set is 4000, what is the real bytes of working set?
thanks in advance,
George
|
|
|
|
|
I have a question :
Why do you need to calculate the real values of the working sets?
|
|
|
|
|
I need to get the real (actual) value of physical memory consumed. Any idea about my original question, Maximilien?
regards,
George
|
|
|
|
|
two project A and B connect by socket
A:
<br />
int iSend = send(sock,buf,1024*16,0); <br />
B:
<br />
fd_set fdread, fdExcept;<br />
FD_ZERO(&fdread);<br />
FD_ZERO(&fdExcept); <br />
FD_SET(ssock,&fdread); <br />
FD_SET(ssock,&fdExcept); <br />
<br />
int iRet = select(0, &fdread, NULL, &fdExcept, &timeOut);<br />
<br />
<br />
if(iRet < 1) <br />
{ <br />
break;<br />
} <br />
else<br />
if(FD_ISSET(ssock,&fdExcept)) <br />
{ <br />
<br />
break;<br />
} <br />
else<br />
if(FD_ISSET(ssock,&fdread)) <br />
{<br />
<br />
<br />
<br />
char buf[1024*16] = {0};<br />
<br />
iRecv = recv(ssock, buf, 1024*16, 0);<br />
}<br />
<br />
if B not use select, but only use
<br />
iRecv = recv(ssock, buf, 1024*16, 0);<br />
and that iRecv equals 1024*16
|
|
|
|
|
For stream-oriented protocols...
A recv() call is successful if the return value is anything
except 0 or SOCKET_ERROR. It's up to you to keep track of
how many bytes are received each call and call recv()
additional times if necessary until the amount of data you
are expecting is received.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
Is there a way of setting keys, like HKey_LOCAL_MACHINE from a remiote terminal on a LAN, on another machine. I assume full adminitrator Access Rights from the calling machine. Is there a non destructive remote Read Way with fewer access rights to read from Similar key.
Regards
Bram van Kampen
|
|
|
|
|
you can try RegConnectRegistry
|
|
|
|
|
Among the services, there is one named RemoteRegistry. In order to access the registry of another computer, you need that service properly configured both on your computer and the remote computer.
|
|
|
|
|
I'm working on setting up a menu to choose which type of sort is wanted, as well as how many numbers in the array, and the numbers for the array.
Trying to figure out how to get my values into the array isn't going according to the examples in the book. I could really use help!
I've pasted my code below.
Thank you!
#include <iostream>;
using namespace std;
// Function prototypes
void selectionSort(int [], int);
void showArray(int [], int);
void sortArray(int [], int);
void showMenu ();
void displayName();
void numberOfValues(int);
void enterValues(int);
int main()
{
int choice; // To hold a menu choice
// Find out the type of sort wanted
do
{
// Display the menu and get the user's choice.
showMenu();
cin >> choice;
if (choice != 3)
{
if (choice = 1)
numberOfValues(int numbers);
enterValues();
sortArray(int [], int);
else if (choice = 2)
numberOfValues(numbers);
enterValues();
selectionSort();
}
}
}while (choice !=3);
Return 0;
}
}
//**************************************************************
// Definition of function selectionSort. *
// This function performs an ascending order selection sort on *
// array. size is the number of elements in the array. *
//**************************************************************
void selectionSort(int array[], int size)
{
// Display the values.
cout << "The unsorted values before the first selection pass are:\n";
cout << "\t\t\t ";
showArray(values, SIZE);
int startScan, minIndex, minValue;
int x = 1;
for (startScan = 0; startScan < (size - 1); startScan++)
{
minIndex = startScan;
minValue = array[startScan];
for(int index = startScan + 1; index < size; index++)
{
if (array[index] < minValue)
{
minValue = array[index];
minIndex = index;
}
}
array[minIndex] = array[startScan];
array[startScan] = minValue;
cout << "After pass #" << x << " the values are ";
showArray(array, index);
x = x + 1;
// Display the values again.
cout << "The final sorted values for this selection sort are:\n";
cout << "\t\t\t ";
showArray(array, SIZE);
}
// Display the values.
cout << "The unsorted values before the first bubble pass are:\n";
cout << "\t\t\t ";
showArray(array, SIZE);
sortArray(array, SIZE);// Sort the values.
// Display them again.
cout << "The final sorted values for this bubble sort are:\n";
cout << "\t\t\t ";
showArray(array, SIZE);
//return 0;
}
//***********************************************************
// Definition of function sortArray *
// This function performs an ascending order bubble sort on *
// array. size is the number of elements in the array. *
//***********************************************************
void sortArray(int array[], int size)
{
bool swap;
int temp;
int x = 1;
do
{
swap = false;
for (int count = 0; count < (size - 1); count++)
{
if (array[count] > array[count + 1])
{
temp = array[count];
array[count] = array[count + 1];
array[count + 1] = temp;
swap = true;
}
}
cout << "After pass #" << x << " the values are ";
showArray(array, 6);
x = x + 1;
} while (swap);
}
//*************************************************************
// Definition of function showArray. *
// This function displays the contents of array. size is the *
// number of elements. *
//*************************************************************
void showArray(int array[], int size)
{
for (int count = 0; count < size; count++)
cout << array[count] << " ";
cout << endl;
}
void showMenu ()//choose type of sort to do
{
cout << "What would you like to do?\n";
cout << "\t1\tBubble Sort\n";
cout << "\t2\tSelection Sort\n";
cout << "\t3\tQuit\n";
cout << "Enter your selection:\n";
cin >> selection;
}
void displayName()
{
cout << "This program was created by Laura Sullivan.\n";
}
void numberOfValues(int numbers)
{
int numbers; //size of array
cout << " How many values do you want in the array (enter 6, 7, 8, 9 only):\n";
cin >> numbers;
}
void enterValues()
{
int numbers; //size of array
const int SIZE = numbers;
int values[SIZE] = {numbers};
cout << "Enter your values (0 through 9), with a space between each value:\n";
cin >> values[numbers];
}
|
|
|
|
|
Do you know that equality test operator is == (while = is the assignment operator)?
BTW use <pre> tags to enclose code snippets, for instance:
<pre>
</pre>
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Hello everyone!
Miss me? No? Aww.
Anyway, I'm trying to make a very simplistic Paint clone. I have a question: I trap mouse drawing with WM_MOUSEMOVE. However, it draws in dots, as in, if I want a doodle I have to go very slowly. How would I fix this? Maybe interpolating; drawing a line between the previous and current dots? But that would be very squareish...
Can somebody fill me with their wisdom so I can figure this out? Thanks!
Windows Calculator told me I will die at 28.
|
|
|
|
|
Windows does not send the application a WM_MOUSEMOVE message for each pixel the mouse pointer passes on, hence you have to deal with a discrete set of disconnected points. You can either (as you realized) connect them with straight lines the obtained point or use some curve (for instance splines) to make the path appear smoother.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
I'll try the straight line then and then the curved one, if it doesn't look good. Thanks!
Windows Calculator told me I will die at 28.
|
|
|
|
|
Hi
One for the hardcore coders ..
I would like to display a window in a VC++ app that is a web view, in that the source for the view is a .SVG file (the Web XML vector graphics format).
BUT .. I need to be able to interact with the view from the C++ code - I need to modify the colour of certain parts of the picture (tagged appropriately in the SVG file). The colours may change dynamically, depending on other parts of the program.
Anyone done anything like this ?
cheers,
Neil
|
|
|
|
|
I've been dealing with SVGZ files (the compressed version of SVG) for the last couple of weeks. From what I've seen, there's very little in the way of libraries that support displaying SVG or SVGZ data directly in a window.
Adobe has a thing called Adobe SVG Viewer that might be of some help to you. Be warned, however. They have discontinued support for it.
It appears that most people's interest is in adding support for SVG to various web browsers. It's indirect, but you might investigate hosting the browser in a window, which then hosts the SVG.
My interest was quite limited (I have some static SVG's I need to display), so I ended up using Adobe Illustrator to convert the SVGZ files to enhanced metafiles and displaying those. I don't know how difficult it is, but that might be another option for you. Here's[^] an article in the MSDN on metafiles to get you started.
|
|
|
|
|
Thanks for that.
I am going to try the ActiveX adobe.svgctl for the moment, and see if I can figure out how to do the necessary directly from VC++. I'll post again if I get it working!
cheers,
Neil
|
|
|
|
|
Hi,
I ahve a problem with one of my Doc-View Application. In fact, I am novice in doc-view apps. I have a CFormView based SDI app coded in Visual C++ 6.0 environment. The user interface has three modeless dialogs embedded in a CTabCtrl, One ChartCtrl and CListCtrl. I observed a funny behaviour while opening a stored document (not Word document) by double clicking on it. The view is not getting updated correctly. But if I open the the file by File-> Open command, every thing working fine.
Let me explain a bit about how I coded the app for better comprehension.
1. The document has a user defined class which handles the serialization on its own (based on Ravi Bhavnani code).
2. The List control paints its contents using NMCustomDraw feature.
3. By digging into the code I could find that OnNewDocument() function is not getting called while opening tha App from Shell (i.e. by double clicking on the file), instead the OnOpenDocument() is called. And all other Doc->DeleteContents() and Serailization, View->IntialUpdate() and View->OnUpdate() working OK but the List Control not getting updated.
4. But if you open the file by File ->Open command, since the SDI app gets started with a new document every thing looks OK.
5. Same is the case by opening with command line Start-> Run-> MyApp xyz.tnf .
6. I found even the OnCustomDraw() function getting called.
7. I then tried to get into the undocumented DocManager classes etc. but I couldn't get much help. Even opening file from the Shell, I find App gets one empty document. This I got confirmed with DocManager class other functions.
Finally what I could find is that, the View and Document connection in the low level framework is at fault.
I would be grateful for any help in this regard.
I remain,
Shanmukha
|
|
|
|
|
Updated:
I add /Op as a compiler option for release version, it's ok.
It quite likes a comparing inaccuracy problem.
Try tomorrow...
zzzzzz
-----------------------
I use these functions to change the lum of an rgb color.
The debug version and release versions have different result.
Why? Thanks.
void RGB2HSL(COLORREF rgb,REAL *pH,REAL *pS,REAL *pL)
{
REAL var_R=REAL(GetRValue(rgb))/255.f;
REAL var_G=REAL(GetGValue(rgb))/255.f;
REAL var_B=REAL(GetBValue(rgb))/255.f;
REAL var_min=min(var_R,var_G);
var_min=min(var_min,var_B);
REAL var_max=max(var_R,var_G);
var_max=max(var_max,var_B);
REAL delta_max=var_max-var_min;
*pL=(var_max+var_min)*0.5f;
if (delta_max==0.f) {
*pH=0.f;
*pS=0.f;
} else {
if (*pL<0.5f)
*pS=delta_max/(var_max+var_min);
else
*pS=delta_max/(2.f-var_max-var_min);
REAL delta_R=(((var_max-var_R)/6.f)+(delta_max*0.5f))/delta_max;
REAL delta_G=(((var_max-var_G)/6.f)+(delta_max*0.5f))/delta_max;
REAL delta_B=(((var_max-var_B)/6.f)+(delta_max*0.5f))/delta_max;
if (var_R==var_max)
*pH=delta_B-delta_G;
else if (var_G==var_max)
*pH=(1.f/3.f)+delta_R-delta_B;
else if (var_B==var_max)
*pH=(2.f/3.f)+delta_G-delta_R;
if (*pH<0.f) ++*pH;
if (*pH>1.f) --*pH;
}
}
inline REAL Hue_2_RGB(REAL v1,REAL v2,REAL vH)
{
if(vH<0.f)
++vH;
if(vH>1.f)
--vH;
if((vH*6.f)<1.f)
return(v1+(v2-v1)*vH*6.f);
if((vH*2.f)<1.f)
return(v2);
if((vH*3.f)<2.f)
return(v1+(v2-v1)*((2.f/3.f)-vH)*6.f);
return(v1);
}
void HSL2RGB(REAL H,REAL S,REAL L,COLORREF &rgb)
{
REAL R,G,B;
if (S==0.f) {
R=L*255.f;
G=L*255.f;
B=L*255.f;
} else {
REAL var_1,var_2;
if (L<0.5f)
var_2=L*(1.f+S);
else
var_2=(L+S)-(S*L);
var_1=L*2.f-var_2;
R=Hue_2_RGB(var_1,var_2,H+(1.f/3.f))*255.f;
G=Hue_2_RGB(var_1,var_2,H)*255.f;
B=Hue_2_RGB(var_1,var_2,H-(1.f/3.f))*255.f;
}
rgb=RGB(R,G,B);
}
modified on Saturday, February 02, 2008 1:02:11 PM
|
|
|
|
|
So what is the difference while compile (or executable) in kind of two mode?
|
|
|
|
|
I don't known in detail.
I'm finding a quick answer.
|
|
|
|
|
I chnaged the way of equality comparison from
S==0.f
to
S>-0.000001f && S<0.000001f
It seems ok, and must be faster than using
"/Op" or pragma optimize("p",on)
|
|
|
|
|