|
Do you have the sources/project for this "internally developped DLL"? If yes, try the following: load the project for the DLL, build it and hit F5, VS should ask you to specify the executable you want to test your DLL with (if it doesn't, you can specify that somewhere in the project settings, can't recall where now), browse for your exe, select it and let it run (make it so it will load the DLL you just built, like, placing the executable right next to the DLL) and see if there are any exceptions thrown, check the debugger's output window too for any hints, maybe you will see something useful.
> 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.<
|
|
|
|
|
Hello Experts,
I need to transfer image via Socket, somtimes image may be same or may somewhat similar.
I am trying to get diffrenece of images so that I can be sent faster via socket.
Image type is jpeg...Please suggest how to send min data of image?
|
|
|
|
|
john5632 wrote: I am trying to get diffrenece of images so that I can be sent faster via socket.
This may not be totally helpful, but it may help direct you.
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
hello Friends
I come across to this situation first time and googled a lot but no Luck.
I am adding two multipleDocTemplates except their Document class is Different.
Now,I am opening a File using one Document template but I want to save that File using another Document template.
Where and how will i switch to another Doc Template so that when I save it uses another Doc template.
An Ideas??
Regards
Yogesh
|
|
|
|
|
I need some help with the jump physics example I found on the web.
The following code makes my character go up and down, but I have to press and hold down the arrow-up key on my keyboard.
I want my character to complete a full jump cycle without having to hold the arrow-up key down.
I want to be able to press down on the key once and release to do a complete jump.
Do I need to somehow include a do while loop? :confused
Thanks!
bool jumping;
const float step = 0.05f; const float limit = 1.0f;
if (GetAsyncKeyState(VK_UP)== TRUE) {
static float jump = 0.0f;
static float strength = limit;
if(jumping){
jump += step;
if(jump <= limit){
strength -= step;
player.y += (step * strength);
}
else{
strength += step;
if(player.y - (step * strength) <= 0.0f)){
player.y = 0.0f;
jumping = false; jump = 0.0f;
strength = limit; }
else{
player.y -= (step * strength);
}
}
}
}
|
|
|
|
|
OK, this code is posted "out of context" (it simply starts with the "if" statement, not how you got there).
A reasonable assumption given your problem statement is that this code is run as part of an "OnChar()" or other event *caused* by your holding a key down.
If that's the case, and you want to convert this to code that runs in a loop, you need to address two things.
1) what event starts the "jumping"?
2) what event stops the "jumping"?
Clearly, right now event 1) is you holding down a key, event 2) is when you let it go. Letting the key go is *not* an event, it's the absence of a key_down event. You'll need to figure out the "stop" event first.
|
|
|
|
|
Hi Chuck O'Toole,
thanks for the quick reply.
These are global variables:
bool jumping;
const float step = 0.05f;
const float limit = 1.0f;
And the rest of the code below is contained inside of my game rendering function. The jump code works when I press the arrow-key, it just does't work correctly.
BOOL StartGame ()
{
if (GetAsyncKeyState(VK_UP)== TRUE)
{
static float jump = 0.0f;
static float strength = limit;
if(jumping){
jump += step;
if(jump <= limit){
strength -= step;
player.y += (step * strength);
}
else{
strength += step;
if(player.y - (step * strength) <= 0.0f)){
player.y = 0.0f;
jumping = false;
jump = 0.0f;
strength = limit;
}
else{
player.y -= (step * strength);
}
}
}
return TRUE;
}
|
|
|
|
|
If I got you: use a tristate variable instead of a boolean, say jump_state .
enum JumpState
{
JS_IDLE,
JS_START,
JS_JUMPING
};
jump_state = JS_IDLE;
if (GetAsyncKeyState(VK_UP) == TRUE)
if (jump_state == JS_IDLE)
jump_state = JS_START;
else
if (jump_state == JS_START)
jump_state == JS_JUMPING;
if ( jump_state == JUMPING)
{
if ( landed )
jump_state == JS_IDLE;
}
Veni, vidi, vici.
|
|
|
|
|
|
Thank you.
Veni, vidi, vici.
|
|
|
|
|
Hey guys,
thanks again for y'alls help. I got it working now. You guys are great!
|
|
|
|
|
You are welcome.
Veni, vidi, vici.
|
|
|
|
|
I am doing interprocess communication bwtween a, DOS console program
and a windows program using named pipes
I need to allocate an object that will remain active while communication is going on between the DOS consile app and the Windows
I know that typically object is allocated on the stack
E.g however if I use the new operator would that
Leave the object alkocated until I do a delete
|
|
|
|
|
ForNow wrote: if I use the new operator would that
Leave the object alkocated until I do a delete
Yes - see here[^].
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
|
|
|
|
|
what type of object are you talking about, is it class-object or any primitive type. in both case you can take services of auto_ptr and stl::list class to keep you object alive between communication and once your program exit, stl and auto_ptr will take care of destruction of your object.
"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
|
|
|
|
|
You will need to look at the various ways of sharing data between processes, it can be a little complicated.
When you use the new opperator you are allocating storage on the heap, however each process has its own heap, and the addresses in one process' heap and not usually accessible to another process, but the can be done using interprocess messaging.
Windows hooks are another very powerful way for processes to share memory, but there is no 'global' memory in windows.
And yes, you need to use delete to free the memory.
==============================
Nothing to say.
|
|
|
|
|
I am not looking for a method of communicationg between process for that I am using named pipes
What I am looking for is persistent storage storage that will remain allocated between the interprcess communocation calls
|
|
|
|
|
Dude, I'm sure *you* know what you're talking about but it's not coming through in your posts.
You have 2 programs, a "Client" and a "Server" using pipes. You have a "System" where these two program are running.
Where do you want this "persistent" object to live, in one program or the other or in the operating system (Windows)? What do you want this object for? Depending on what you are going to do with the object, some objects are better than others.
Unless you are clear as to what you want it for and where it's to live, you will get some pretty unstatisfying suggestions, like "Open a file, that'll persist"
|
|
|
|
|
OK, use 'new' and 'delete' (malloc and free) for persistent storage, or you can declare global storage during the life of the process by declaring a global array (you declare it outside of any functions normally just after where you include header files).
==============================
Nothing to say.
|
|
|
|
|
Here's my code for Digital Library system
#include<fstream.h>
#include<conio.h>
#include<stdio.h>
#include<process.h>
#include<string.h>
#include<iomanip.h>
#include<iostream>
//***************************************************************
// CLASS USED IN PROJECT
//****************************************************************
class book
{
char bno[6];
char bname[50];
char aname[20];
public:
void create_book()
{
cout<<"\nNEW BOOK ENTRY...\n";
cout<<"\nEnter The book no.";
cin.getline(bno,6);
cout<<"\n\nEnter The Name of The Book ";
cin.getline(bname,50);
cout<<"\n\nEnter The Author's Name ";
cin.getline(aname,20);
cout<<"\n\n\nBook Created..";
}
void show_book()
{
cout<<"\nBook no. : "<<bno;
cout<<"\nbook="" name="" :="" "<<bname;
="" cout<<"author="" "<<aname;
="" }
="" char*="" retbno()
="" {
="" return="" bno;
="" void="" report()
="" {cout<<bno<<setw(30)<<bname<<setw(30)<<aname<<endl;}
};="" class="" ends="" here
="" ***************************************************************
="" global="" declaration="" for="" stream="" object,="" object
="" ****************************************************************
fstream="" fp,fp1;
book="" bk;
="" function="" to="" write="" in="" file
="" ****************************************************************
void="" write_book()
{
="" char="" ch;
="" fp.open("book.txt",ios::out|ios::app);
="" do
="" system="" ("cls");
="" bk.create_book();
="" fp.write((char*)&bk,sizeof(book));
="" cout<<"\n\ndo="" you="" want="" add="" more="" record..(y="" n?)";
="" cin="">>ch;
}while(ch=='y'||ch=='Y');
fp.close();
}
//***************************************************************
// function to read specific record from file
//****************************************************************
void display_spb(char n[])
{
cout<<"\nBOOK DETAILS\n";
int flag=0;
fp.open("book.txt",ios::in);
while(fp.read((char*)&bk,sizeof(book)))
{
if(strcmpi(bk.retbno(),n)==0)
{
bk.show_book();
flag=1;
}
}
fp.close();
if(flag==0)
cout<<"\n\nBook does not exist";
getch();
}
//***************************************************************
// function to delete record of file
//****************************************************************
void delete_book()
{
char n[6];
system ("cls");
cout<<"\n\n\n\tDELETE BOOK ...";
cout<<"\n\nEnter The Book no. of the Book You Want To Delete : ";
cin>>n;
fp.open("book.txt",ios::in|ios::out);
fstream fp2;
fp2.open("Temp.txt",ios::out);
fp.seekg(0,ios::beg);
while(fp.read((char*)&bk,sizeof(book)))
{
if(strcmpi(bk.retbno(),n)!=0)
{
fp2.write((char*)&bk,sizeof(book));
}
}
fp2.close();
fp.close();
remove("book.txt");
rename("Temp.txt","book.txt");
cout<<"\n\n\tRecord Deleted ..";
getch();
}
//***************************************************************
// function to display Books list
//****************************************************************
void display_allb()
{
system ("cls");
fp.open("book.txt",ios::in);
if(!fp)
{
cout<<"ERROR!!! FILE COULD NOT BE OPEN ";
getch();
return;
}
cout<<"\n\n\t\tBook LIST\n\n";
cout<<"=========================================================================\n";
cout<<"Book Number"<<setw(20)<<"book name"<<setw(25)<<"author\n";
="" cout<<"="========================================================================\n";
" while(fp.read((char*)&bk,sizeof(book)))
="" {
="" bk.report();
="" }
="" fp.close();
="" getch();
}
="" ***************************************************************
="" introduction="" function
="" ****************************************************************
void="" intro()
{
system="" ("cls");
="" gotoxy(35,11);
="" cout<<"library="" ";
="" gotoxy(35,14);
="" cout<<"management";
="" gotoxy(35,17);
="" system";
="" cout<<"\n\nmade="" by="" :="" team="" alpha";
="" cout<<"\n\ngiki";
="" getch();
}
="" administrator="" menu="" admin_menu()
{
system="" int="" ch2;
="" cout<<"\n\n\t1.create="" book="" cout<<"\n\n\t2.display="" all="" books="" cout<<"\n\n\t3.display="" specific="" cout<<"\n\n\t4.delete="" cout<<"\n\n\t5.back="" to="" main="" menu";
="" cout<<"\n\n\tplease="" enter="" your="" choice="" (1-5)="" cin="">>ch2;
switch(ch2)
{
case 1: system ("cls");
write_book();
break;
case 2: display_allb();
break;
case 3: {
char num[6];
system ("cls");
cout<<"\n\n\tPlease Enter The book No. ";
cin>>num;
display_spb(num);
break;
}
case 4: delete_book();break;
case 5: return;
default:cout<<"\a";
}
admin_menu();
}
//***************************************************************
// THE MAIN FUNCTION OF PROGRAM
//****************************************************************
int main()
{
char ch;
intro();
do
{
system ("cls");
cout<<"\n\n\n\tMAIN MENU";
cout<<"\n\n\t01. ADMINISTRATOR MENU";
cout<<"\n\n\t02. EXIT";
cout<<"\n\n\tPlease Select Your Option (1-4) ";
ch=getche();
switch(ch)
{
case '1':admin_menu();
break;
case '2':exit(0);
default :cout<<"\a";
}
}while(ch!='4');
}
//***************************************************************
// END OF PROJECT
//***************************************************************
I'm unable to enter the books without skipping the book code (the program omits it). Also, once i create a book entry, when i try to display all the books, at times, the file does not open.
Please point out any mistakes and resolve them as this is my project due today.
Any help would be appreciated
my program need to be able to write, read, delete and search a database.
ST
VB 6 user!
|
|
|
|
|
|
This is my first time using try and catch in c++. I know how to use it in vb, but not sure in c++. I would like to capture the error message or code, and do something, but I'm not what to put there, and the format required so it works.
I did google this, but all I could find was char str.
try {
hr = CoCreateInstance( __uuidof(AppHostWritableAdminManager), NULL,
CLSCTX_INPROC_SERVER, __uuidof(IAppHostWritableAdminManager), (void**) &pMgr);
}
catch ( char str ) {
goto CLEANUP;
}
|
|
|
|
|
try this
catch (CDBException *e)
{
AfxMessageBox("Caught Error: " + e->m_strError);
}
or use CException *e instead of the Database class variant.
In other words, you have to "catch" what something else "throws" and that depends on what routines you are calling that could throw an exception.
|
|
|
|
|
Thanks Chuck
Is it different for just straight win32?
CDBException
[EDIT]
Nevermind, it's just like vb, I just need to find the correct value for comm.
|
|
|
|
|
I don't do a lot of non-MFC these days because I find the classes so useful. It's also hard to show something useful without it containing a lot of stuff that's specific to my application and would make no sense to you. CDBException is for errors coming from CDatabase and CRecordset classes.
Here's my general exception catcher in the main loop of my application. Ignore things that are related to sending messages back to the user (client / server app).
catch (CException * cfe)
{
char exceptBuf[255];
CString ts;
CString ccnum;
if (!cfe->GetErrorMessage(exceptBuf, sizeof(exceptBuf)))
exceptBuf[0] = '\0';
#ifdef _DEBUG
AfxMessageBox(exceptBuf);
#endif
if (claim_check != NULL)
ccnum = claim_check->getClaimCheck();
else
ccnum = "000000";
ts.Format("Internal Exception Trap - %s", exceptBuf);
TheLogFile->LogThis(ccnum + CString(" : ") + ts);
sendErrorToGUI(ts, E_DEFAULTERROR, TheCommCenter, claim_check, parsed_request, inputConfig);
}
|
|
|
|
|