|
Sorry, didn't read the root message.
When you specify res://exe-name/resource, is the resource specified as HTML or JAR (or something else)..?
At the back of my mind is that there was some kind of problem with this on Win9x at some point.
Steve S
|
|
|
|
|
Hi Steve,
The jar file is specified as HTML, as it is the images and javascripts files. One funny thing is: I have just made a page in FrontPage using the file:/// protocol and the page works fine in the browser. If I use the same page in the application resources I got a Exception in the applet location in the page.
Thanks
Crercio O. Silva / DBTools Development
http://www.dbtools.com.br
|
|
|
|
|
Short answer is: Sorry, can't be done.
When you start a Java applet, the browser passes the URL of the applet codebase to the Java Virtual Machine. The JVM is not going to understand a res: URL, and it is specifically prohibited from using a file: URL to load an applet because of all sorts of security problems.
What you should be able to do is run the applet as a regular Java application, in which case the JVM is free to access the local disk to find the Jar file. Often applets will also have a "main" function that lets you run them as a regular application; if yours does not you will have to write another Java class with a "main" function that creates a frame and starts the applet within it.
If your applet code needs tighter integration with your MFC app than running as a separate Java process will allow, you might have to look at the JNI (Java Native Interface), or whatever the equivalent is for Microsoft's brain-damaged JVM, to incorporate the Java runtime into your application.
|
|
|
|
|
Hi antlers,
That sounds amazingly harder than I thought. Would you think it would be a better idea to use ActiveX controls instead of applets? Would the use of ActiveX controls present the same kind (or maybe different) of problems?
Thanks a lot for your explanation. It helped me a lot to understand the process.
Crercio O. Silva / DBTools Development
http://www.dbtools.com.br
|
|
|
|
|
I guess ActiveX controls would work. You might need to have them installed along with the app on the machine instead of read from the resource file though.
Microsoft wrote some extensions to their JVM that allow Java stuff to be accessed as ActiveX controls, and I suspect that doing this would be the least work for you (unless recoding the applets is really easy). I haven't used Java this way myself, but check
http://www.codeguru.com/java/tij/tij0195.shtml
|
|
|
|
|
hi there
i have been working on a mathematical program, and i need some way to measure elapsed time between 2 operations precisely (if possible, as precise as sciencemark has in its primordia benchmark: www.sciencemark.org), but i dont like just going out and using some third party class... right now I am able to measure "only" up to miliseconds...
thanx
Thiago
|
|
|
|
|
Given that Windows is not a resal-time OS, much precision is not going to be a reality. Depending on your OS (e.g., 9x, NT), the timer resolution will range from 10ms to 55ms. Read this site for more.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
A common trick is to measure multiple executions of a function and then calculate the execution time from the result. For example, you could run your functions 100,000 times. Then you divide the result by 100,000 to get the time for a single execution.
Off course a lot of things can and do go wrong with this. On Windows you will not get really good data for many reasons. But this method produces an upper bound of maybe higher precision than what you have now.
Lorenz Prem
Microsoft Corporation
|
|
|
|
|
#include <iostream>
#include <fstream>
using namespace std;
char matrix [3][3]; //Tic Tac Toe Matrix
char check();
void init_matrix();
void get_player_move();
void get_computer_move();
void disp_matrix();
int main()
{
char done = ' ';
init_matrix();
ofstream examplefile("example.txt");
do
{
disp_matrix();
get_player_move();
done = check(); //See if any winner
if(done != ' ') break; //Winner!!!
get_computer_move();
done = check(); //See if any winner again
if(done != ' ') break;
} while(done == ' ');
if(done == 'X')
{
if (examplefile.is_open())
{
examplefile << "Winner: X\n";
examplefile.close();
}
cout << "You won!!!\n";
}
if(done == 'O')
{
if (examplefile.is_open())
{
examplefile << "Winner: O\n";
examplefile.close();
}
cout << "I won!!!\n";
}
else
{
if (examplefile.is_open())
{
examplefile << "Winner: Draw\n";
examplefile.close();
}
cout << "Draw!!!\n";
}
disp_matrix(); //Display final matrix
return 0;
}
//Initialize the matrix
void init_matrix()
{
int i, j;
for(i=0; i<3; i++)
for(j=0; j<3; j++)
matrix[i][j] = ' ';
}
//Get the player's move
void get_player_move()
{
int x, y;
cout << "Enter X,Y coordinates for your move: ";
cin >> x;
cin >> y;
x--; y--;
if(matrix[x][y]!= ' ')
{
cout << "Invalid move, try again.\n";
get_player_move();
}
else matrix[x][y] = 'X';
}
//Get a move from the computer
void get_computer_move()
{
/*
int i, j;
if(matrix[i][j] !=' ')
if(i*j==9)
{
cout << "draw\n";
system("pause");
}
else
matrix[i][j] = 'O';
*/
}
//Display the matrix
void disp_matrix()
{
int t;
for(t=0; t<3; t++) {
cout << matrix[t][0] << " | " << matrix[t][1] << " | " << matrix[t][2];
if(t != 2)
cout << "\n---|---|---\n";
}
cout << "\n";
}
//See if any winner
char check()
{
// New checking system
int i;
for(i=0; i<3; i++) // Check rows
if(matrix[i][0]==matrix[i][1] && matrix[i][0]==matrix[i][2])
{
return matrix[i][0];
}
for(i=0; i<3; i++) // Check columns
if(matrix[0][i]==matrix[1][i] && matrix[0][i]==matrix[2][i])
{
return matrix[0][i];
}
//Test diagonals for winner
// Left to right
if(matrix[0][0]==matrix[1][1] && matrix[1][1]==matrix[2][2])
{
return matrix[0][0];
}
// Right to left
if(matrix[0][2]==matrix[1][1] && matrix[1][1]==matrix[2][0])
{
return matrix[0][2];
}
/*
// Old checking system
// Check rows
if(matrix[0][0] == matrix[0][1] && matrix[0][0] == matrix[0][2])
{
return matrix[0][0];
}
if(matrix[1][0] == matrix[1][1] && matrix[1][0] == matrix[1][2])
{
return matrix[1][0];
}
if(matrix[2][0] == matrix[2][1] && matrix[2][0] == matrix[2][2])
{
return matrix[2][0];
}
// Check columns
if(matrix[0][0] == matrix[1][0] && matrix[0][0] == matrix[2][0])
{
return matrix[0][0];
}
if(matrix[0][1] == matrix[1][1] && matrix[0][1] == matrix[2][1])
{
return matrix[0][1];
}
if(matrix[0][2] == matrix[1][2] && matrix[0][2] == matrix[2][2])
{
return matrix[0][2];
}
// Check diagonal (left to right)
if(matrix[0][0]==matrix[1][1] && matrix[1][1]==matrix[2][2])
{
return matrix[0][0];
}
// Check diagonal (right to left)
if(matrix[0][2]==matrix[1][1] && matrix[1][1]==matrix[2][0])
{
return matrix[0][2];
}
*/
return ' ';
}
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
Hi all,
i have an SDI application. when i run it and select a document from the recent list, it is loaded perfectly calling "OnOpenDocument" method.
after that i close the file using 'File->Close' and the method "OnCloseDocument" is called as well...
then i select the file again and nothing happens..... i've placed a break point in the "OnOpenDocument" method and saw it didn't reached there.....
can any1 help?
thanks
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
http://www.artima.com/intv/goldilocks.html[^]
I especially liked the section "Climbing Above C-Level."
Stroustrup: "The C++ community has yet to internalize the facilities offered by standard C++. By reconsidering the style of C++ use, major improvements in ease of writing, correctness, maintainability, and efficiency can be obtained."
This is all too true. And it certainly applies to the code I'm having to maintain at the moment. It also applies to almost all the C++ code I've had to maintain over the past few years. Part of the problem has been that Standard C++ (STL, etc.) was difficult and certainly when STL was new it was pretty damn difficult to get to grips with. I remember at one time seeing the theoretical document behind the original HP (I think it was HP?) implementation and being completely bamboozled.
However, today there are plenty of good books around so current C++ developers should have no excuse for avoiding it (though Francis Glassborow of The Association of C and C++ Users tells me that the majority of professional programmers don't read books on programming so this may have something to do with it). Sure Standard C++ is big and does get pretty complicated but in fact basic use of it is easy and can alleviate a lot of common problems. There are lots of worked examples in, e.g., the MS Visual C++ online help. That was my first route into it.
Stroustrup: "Most of these techniques are criticized unfairly for being inefficient. The assumption is that if it is elegant, if it is higher level, it must be slow. It could be slow in a few cases, so deal with those few cases at the lower level, but start at a higher level. In some cases, you simply don't have the overhead. For example, vectors really are as fast as arrays. "
This too rings true. C/C++ developers are often obsessed with perceived inefficiency and often have poor intuition about it. Some time ago I read a case study on the use of Eiffel at a Fortune 500 storage manufacturer. Eiffel is an OO language analogous to Java and C# (i.e., managed runtime, etc.). The project required rewriting an existing C application in Eiffel. The developers were new to Eiffel and had the intuition that performance would be inferior as a result of Eiffel's managed runtime. In fact, it turned out that the new application was 10 times faster. Obviously, much of this performance boost would have been due to moving to a more efficient OO design, resulting in more code re-use. Also, no doubt the C application would have been faster than the original had it been redesigned in C. Still, it showed up the poor intuition of the C developers. We should aim first at maintainability and correctness. Efficiency will often follow as a consequence.
Kevin
|
|
|
|
|
Dear developers,
One never knows to what edge freelance development can take you, like it did to me now all desperate to find a database implementation for embedded systems that are not .NET or 0x86 compatible. I have a pure C/C++ portable platform for some sort of programmable terminals, and I need a more or less generic implementation of a simple database, preferably with indexes or some sort of optimization. Any table is deemed to never have more than 1000 records. And the entire database is best residing in a single file. It’s killing me to think that these progressing days I would have to marvel it all on my own like in old times.
One last detail: It would be the nicest implementation with file-access level implemented clearly, like a driver so that I could just insert my own file-access operations that will work for me.
Anyone who has whatever relevant please, throw at me, be endlessly grateful for that.
Regards,
Just one of you.
|
|
|
|
|
Hi all,
I am using the following code:
CArray<int,int> myArray;
for (int i=0;i < 10;i++)
myArray.Add(i);
myArray.RemoveAt(5);
TRACE(_T("\n"));
for ( i = 0; i < myArray.GetSize(); i++)
{
TRACE(_T("%d\n"),myArray.GetAt(i));
}
TRACE(_T("size is : %d"),myArray.GetSize());
TRACE(_T("\n"));
myArray.SetAtGrow(5,200);
for ( i = 0; i < myArray.GetSize(); i++)
{
TRACE(_T("%d\n"),myArray.GetAt(i));
}
TRACE(_T("size is : %d\n\n"),myArray.GetSize());
problem is, both sizes are 9 in the debug output window....
and for the second time i print the array i see that 200 is instead of 6 and not 5!!!??????
can any1 help here?
thanks
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Yep pretty normal... SetAtGrow only increases the size if the index specified is bigger than the actual size... I bet you need InsertAt rather than SetAtGrow
|
|
|
|
|
hi,
thanks for reply,
i've managed with SetAt instead of remove and then setatgrow....
thanks
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Hi ive got app with Static splitter window. On each pane there is a listctrl (classic file explorer). When i first start my app i cant get any item focused even if i use SetActivePane and SetItemState. The same problem i have when i try to change view with tab key. The pane is active (or i quess so) but no list member is activated till i mouse click on it.
Can u help me plz ? Thanks in advance.
|
|
|
|
|
im making a mp3 player and i want to get the end o the music to pass to the next music in the list
im actually doing this:
while(MCIWndGetPosition(m_Video) == MCIWndGetEnd(m_Video))
{
::MessageBox(m_Video,"PING","PING",MB_OK);
}
but when the end position ends it doesnt return the testing message box
please somebody help me resolving this issue
Regards
AI_Warrior
Portugal;P
|
|
|
|
|
lol?
what you have here means that the program will loop THROUGH the message box until the end is reached.
once the message box shows, the execution stops here!
if you want to do it that way, it has to look like:
while( player_online )
{
play_next_track();
while( MCIWndGetPosition(m_Video) != MCIWndGetEnd(m_Video) )
Sleep( 1 );
}
but i don't know if this is the optimal way... i propose to use an existing mp3 player, until you've learned how it works the best way!
Don't try it, just do it!
|
|
|
|
|
Hi, how could I send a click through SendMessae or PostMessage ?? I want to use it with a parent window, this way:
CWnd* pWnd = GetParent()
pWnd->SendMessage(/* I don't know where I must send this and how */);
Thanks in advance.
MaestroProgramador.Com
I didn't fail hundred times, I found hundred ways that didn't work.
No fallé cien veces, encontré cien maneras de que no funcionara.
|
|
|
|
|
Click what, a button?
I case of button:
pWnd->SendMessage(WM_COMMAND,MAKEWORD(::GetDlgCtrlID(wndButton),BN_CLICKED),(LPARAM)wndButton);
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
For example, a listctrl is parent of a progress bar into it. I want when click on the progress bar to send the clic to the clistctrl that created it, that way. I would like to want how to send the click and where... I mean, where (HWND...).
Thanks in advance.
Rafael Fernández López.
I didn't fail hundred times, I found hundred ways that didn't work.
No fallé cien veces, encontré cien maneras de que no funcionara.
|
|
|
|
|
|
Thanks mike for replying my message but what I wanted to know (and still don't know) is how to post the message.
<br />
CWnd* pWnd = GetParent();<br />
<br />
pWnd->SendMessage();<br />
Thanks everyone !!
Rafael Fernández López.
I didn't fail hundred times, I found hundred ways that didn't work.
No fallé cien veces, encontré cien maneras de que no funcionara.
|
|
|
|
|
|
Yes, that's what I want to do, but I don't know the syntax of SendMessage. Could you type an example please ?
Thank you.
Rafael Fernández López.
I didn't fail hundred times, I found hundred ways that didn't work.
No fallé cien veces, encontré cien maneras de que no funcionara.
|
|
|
|