|
|
Lets say you have a simple project in VC++. Is there an
easy way (or a way) to compile that project so that the
program can be run as a web application? If so, we
visual studio compiler do you need to do this.
Please, any response any one can give me will be greatly
appreciated.
|
|
|
|
|
No there isn't an easy way to do it. You must redesign the application as a Web one (that is, roughly speaking, a client/server one).
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
With that said, why not reply directly to the OP, because he won't otherwise receive any email notification of your post (which might actually be of benefit).
"Real men drive manual transmission" - Rajesh.
|
|
|
|
|
This is of course going to depend on what the C++ applicaiton is doing, and how (of if) it is communicating with other modules.
If it is talking to Hardware, doing DCOM, and generally being very much part of a PC, then no. It is impossible.
If it isnt, then how about just importing the code into a C# project? (And doing the necessary syntax changes)
==============================
Nothing to say.
|
|
|
|
|
I was going to say "it depends", but you were more eloquent about it!
|
|
|
|
|
As others have said, no, not in any universal way.
However, Google's browser Chrome can now run plugins written in C or C++ through their Native Client.
You'd have to use their modified GCC compiler, and it would only work in Chrome, but would let you re-compile to a web app.
|
|
|
|
|
Hi,
I have a button that is supposed to increase the size of an image when it's held down. I want it so that when the button is held down, I get a repeated event.
How do I know in my application that a button is held down, is there an event generated that is sent to the window procedure ?
|
|
|
|
|
You'll get a WM_CHAR message sent each time (a) a key is pressed or (b) a key has been held for long enough to trigger another 'key-pressed' event.
Here's a minimal WindowProcedure
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_DESTROY:
PostQuitMessage (0);
break;
case WM_CHAR:
printf("Key Pressed: %c\n", wParam);
break;
default:
return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}
|
|
|
|
|
thanks for the reply,
but when i say button I mean a button control not a keyboard key.
I'm looking for an event such as WM_COMMAND that is generated while the button is pressed until the button is released. WM_COMMAND though just is generated on click not press as well.
|
|
|
|
|
Since the keyboard auto-repeat, some of the 'low'-level stuff is already done.
If however, you want a button control to have auto-repeat, you'll have to set a timer yourself. I'd imagine that you would set(create) the timer when the particular button was pressed. Each time the timer is triggered, you'd check to see if the button's state indicated that it was pressed. If so, simply send yourself another WM_COMMAND message.
HOWEVER, this task is somewhat complicated by the fact that the WM_COMMAND is not sent by a button until either the mouse-button or the keyboard key that was used to press it is released, meaning that your first event is not fired until after the button is no longer pressed, hence no ability to auto-repeat.
I suspect that you'll need to create this button as a custom-control, handling both the drawing (reasonably easy using the DrawThemeBackground(sp?) function) and the keyboard/mouse handling.
Mouse handling should be pretty straight forward, using SetCapture and ReleaseCapture. You'll have to also work out which keyboard keys you want to be able to press the button too, setting the button's state to BS_PRESSED.
This sounds like about the kind of functionality that the spin-button control offers, albeit with a single button rather than a pair of them. To that end, to find a solution quickly, I'd probably start looking for code for a custom spin-button control, editing as needed to fulfil your needs.
|
|
|
|
|
thanks,
I've managed to get the holding button down to work. I just used a global veriable to track the state of the button via the WM_DRAWITEM notification and then in my program loop referred to this variable.
|
|
|
|
|
Bewdy!
Happy to help you scramble over that little obstacle.
|
|
|
|
|
See if you get BN_PUSHED[^] and BN_UNPUSHED[^] from the button, these are, as the documentation states, provided only for compatibility with 16-bit versions of Windows, so they might not work anymore, but if they do, you could try starting the timer with SetTimer[^] on BN_PUSHED and kill it with KillTimer[^] on BN_UNPUSHED, and do your zooming thing in the handler for WM_TIMER[^].
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
Hi all,
I am trying to read from text file using fscanf.But i am getting only last string.
Here is the code i am trying
FILE *p;
CString first,second;
p=fopen("E:\\Test.txt","r");
fscanf(p,"FirstName=%s",first);
fscanf(p,"SecondName=%s",second);
AfxMessageBox(first);
AfxMessageBox(second);
Here is the Text.txt file content:
FirstName=ee
SecondName=pp
But i am getting only first value "ee" in message box.where i am going wrong
Thanks
manju
|
|
|
|
|
Its been a long time since I used these kinds of funcs, but I would say that like fgets it will read untill it hits an end of line. Can you advance the file pointer?
==============================
Nothing to say.
|
|
|
|
|
You cannot use CString like this because no memory is internally allocated to it.
That is causing the problem here.
Here is something that could work -
FILE *p;
char first[100];
char second[100];
p=fopen("E:\\Test.txt","r");
fscanf(p,"FirstName=%s\r\n",first);
fscanf(p,"SecondName=%s",second);
AfxMessageBox(first);
AfxMessageBox(second);
However, I really think you should start using C++ file streams.
|
|
|
|
|
You must specify the end-of-line in the fscanf format string and, as the superhero already pointed out, you cannot use CString s that way, try:
FILE *p;
CString first,second;
p = fopen("E:\\Test.txt","r");
assert(p);
first.GetBuffer(MAX_PATH); second.GetBuffer(MAX_PATH); assert(first.GetAllocLength()== MAX_PATH && second.GetAllocLength()==MAX_PATH);
fscanf(p,"FirstName=%s\n",first);
fscanf(p,"SecondName=%s\n",second);
first.ReleaseBuffer();
second.ReleaseBuffer();
AfxMessageBox(first);
AfxMessageBox(second);
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Since you are using MFC, why not use CStdioFile instead?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
Hi Developers,
I am using a multi column list box( not list control ) and i have to handle column click because i want to sort the records accordingly, if i am clicked on any column.
Will the sorting work automatically if i click on the column or not?
Please give me some hints.
Thanks.
Amrit Agrawal
Software Developer.
|
|
|
|
|
Are you sure you mean List Box[^] rather than List View[^]? A List Box only contains a single list of items, displayed either vertically or horizontally.
|
|
|
|
|
I am sorry Richard, that is a list control. If I want to handle column click so that i can sort it contents accordingaly, how can i do it.
Thanks.
Amrit Agrawal
Software Developer
|
|
|
|
|
Your first message stated that you were using List Box (not List Control) and I asked you to confirm whether you actually mean List Box or List View. You now say that is it list control so I am still not sure. However, I will make an educated guess that you actually do mean a List View[^] control. In that case you should check the documentation (follow the foregoing link) for the LVN_COLUMNCLICK notification, and also the LVM_SORT??? messages.
|
|
|
|
|
Richard MacCutchan wrote: Your first message stated that you were using List Box (not List Control) and I asked you to confirm whether you actually mean List Box or List View. You now say that is it list control so I am still not sure. Don't you just love playing that game!
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|