|
So does machine A have any part of the database open? When this error pops up, have you checked to see what process may have a file open?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
Yes. From machine A will always be holding a connection with the database until the application exits.
But Access supports shared access of DB. isn't it?
Moreover i am not getting the error at all tries. Only once in 3 or 4 times.
Is there any way of avoiding the locking of the records? i.e allowing two users to update the record at the same time..
I have got something from the web, where they ask to wait for some time and do the process again. But in my case even that doesn't workout.
Please see the link below.
http://www.dbforums.com/archive/index.php/t-525401.html[^]
Thanks
Selva
|
|
|
|
|
SelvaKr wrote: But Access supports shared access of DB. isn't it?
As far as I know it does. But you first need to determine what process has the file(s) open such that machine B cannot update them. Is it your application running on machine A, or some other application?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello everyone,
Here is my understanding of what Bjarne said in his The C++ Programming Language book. I am not sure whether my understanding is correct? I am somewhat confused about the following statements.
My understanding is,
means if a function call like this,
void func(const A a)
then compiler can deduce argument type of template function below to A?
template <class T> func (T a)
Bjarne's original statements are,
--------------------
C.13.4 Deducing Function Template Arguments
A compiler can deduce a type template argument, T or TT , and a nontype
template argument, I, from a template function argument with a type composed of the following constructs:
T const T volatile T
T* T& T[constant_expression]
type[I] class_template_name<T> class_template_name<I>
T T<T > T<I > T<>
--------------------
thanks in advance,
George
|
|
|
|
|
Yes, the only bit you're missing is the call to func
int i = 6;
func( i );
Now the compile can deduce that the call it to template<int> func(int a)</int> . In other words it works out the template types backwards from known matches with parameter types. Clever isn't it, just be glad you aren't implementing a C++ compiler
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Thanks Matthew,
Question answered.
regards,
George
|
|
|
|
|
in a source file(.cpp and .h), how can I know it call the dll?
if it calls the dll, how can I make it call the static lib instead of dll, can anyone give me specific instruction about this topic?
|
|
|
|
|
My head asplode.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
asplode? i think you mean to say explode
"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
|
|
|
|
|
wendyyue wrote: in a source file(.cpp and .h), how can I know it call the dll?
if it calls the dll, how can I make it call the static lib instead of dll, can anyone give me specific instruction about this topic?
The calling of a lib or dll is determined at link time. If you link with the dll's import library, the code will call the dll. If you link with the static library, your code will call that.
Nathan
|
|
|
|
|
Hi all,
I am writing a simple file and reading tha file....
i want to do it through serialization. but don't know where to start from....
Can anybody help me in doing so.....
Thanks in advance
|
|
|
|
|
|
hello everyone
could you pls help me in solving my problem with dll.This is the first time im creating a dll.
i made the dll which has 2 function.
void disp()
{
MessageBox();
}
void retval(int i)
{
return i;
}
in my application i used loadlibrary function for inserting my dll.if i call my first function it does not provide any error but when i call the second function it is generating an error saying "the value of esp is not saved properly across the function call".
Can anybody tell me how to solve it.
Thanks in advance
|
|
|
|
|
void retval(int i)
{
return i;
}
Look at the word VOID that is your return type... I suspect that has a lot of your trouble.
Iain.
Iain Clarke appears because CPallini still cares.
|
|
|
|
|
How did he get to compile it successfully?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
sorry that was a mistake occured while typing this is the exact code and i have commented where the error is occuring
actually the return value was a mistake occured while type.... ill send you the sample code of how i tried to create the dll..it is as follows
//MY APPLICATION FILE
//----------------------------------------------
#include <windows.h>
typedef UINT (CALLBACK* LPFNDLLFUNC1)(VOID);
typedef UINT (CALLBACK* LPFNDLLFUNC2)(LPCSTR);
HINSTANCE hDLL;
LPFNDLLFUNC1 MyFunc1;
LPFNDLLFUNC2 MyFunc2;
UINT uReturnVal;
int main() {
hDLL = LoadLibrary("C:\\sample1.dll");
if (hDLL != NULL)
{
MyFunc1 = (LPFNDLLFUNC1)GetProcAddress(hDLL,"MyDLLFunc1");
MyFunc2 = (LPFNDLLFUNC2)GetProcAddress(hDLL,"MyDLLFunc2");
if (!MyFunc1 || !MyFunc2)
{
//Show error message
FreeLibrary(hDLL);
return false;
}
else
{
uReturnVal = MyFunc1();
uReturnVal = MyFunc2("HELLO WORLD!");//GETTING AN EXCEPTION HERE…..IT IS CALLING THE FUNCTION IN THE DLL BUT AFTER THAT THE EXCEPTION OCCURS
}
}
return true;
}
//----------------------------------------------------------------
//MY DLL CREATION FILE
//-----------------------------------------------------------------------
// sample1.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
int MyDLLFunc1() {
MessageBox(NULL,"My DLL Function 1","",MB_OK);
return true;
}
int MyDLLFunc2(char *TEXT) {
MessageBox(NULL,TEXT,"",MB_OK);
return true;
}
//------------------------------------------------------------------------
//MY DEFINITION FILE
//------------------------------------------------------------------------
LIBRARY sample1
DESCRIPTION This is my DLL file!
EXPORTS
MyDLLFunc1 @1
MyDLLFunc2 @2
//comments
//the error is generating after this line uReturnVal = MyFunc2("HELLO WORLD!");
can you help me out
|
|
|
|
|
In addition to Iain's reply, have you exported the two functions? If you are calling GetProcAddress() , what does it return?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
actually the return value was a mistake occured while type.... ill send you the sample code of how i tried to create the dll..it is as follows
//MY APPLICATION FILE
//----------------------------------------------
#include <windows.h>
typedef UINT (CALLBACK* LPFNDLLFUNC1)(VOID);
typedef UINT (CALLBACK* LPFNDLLFUNC2)(LPCSTR);
HINSTANCE hDLL;
LPFNDLLFUNC1 MyFunc1;
LPFNDLLFUNC2 MyFunc2;
UINT uReturnVal;
int main() {
hDLL = LoadLibrary("C:\\sample1.dll");
if (hDLL != NULL)
{
MyFunc1 = (LPFNDLLFUNC1)GetProcAddress(hDLL,"MyDLLFunc1");
MyFunc2 = (LPFNDLLFUNC2)GetProcAddress(hDLL,"MyDLLFunc2");
if (!MyFunc1 || !MyFunc2)
{
//Show error message
FreeLibrary(hDLL);
return false;
}
else
{
uReturnVal = MyFunc1();
uReturnVal = MyFunc2("HELLO WORLD!");//GETTING AN EXCEPTION HERE…..IT IS CALLING THE FUNCTION IN THE DLL BUT AFTER THAT THE EXCEPTION OCCURS
}
}
return true;
}
//----------------------------------------------------------------
//MY DLL CREATION FILE
//-----------------------------------------------------------------------
// sample1.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
int MyDLLFunc1() {
MessageBox(NULL,"My DLL Function 1","",MB_OK);
return true;
}
int MyDLLFunc2(char *TEXT) {
MessageBox(NULL,TEXT,"",MB_OK);
return true;
}
//------------------------------------------------------------------------
//MY DEFINITION FILE
//------------------------------------------------------------------------
LIBRARY sample1
DESCRIPTION This is my DLL file!
EXPORTS
MyDLLFunc1 @1
MyDLLFunc2 @2
//comments
//the error is generating after this line uReturnVal = MyFunc2("HELLO WORLD!");
can you help me out
|
|
|
|
|
mismatch of calling convention __stdcall in function declaration in exe and possibly __cdecl in the dll. use dll to use __stdcall by default. or always use same prototype for DLL and exe use a common declaration with header files.
"typedef UINT (CALLBACK* LPFNDLLFUNC2)(LPCSTR);" in exe
#define CALLBACK __stdcall // note this.
while "int MyDLLFunc2(char *TEXT)" in dll; // calling conversion possibly differs.
the return type and arguments are different though they are not the cause here.
|
|
|
|
|
Check your calling convention
use:
__stdcall int MyDLLFunc1(){}
__stdcall int MyDLLFunc2(char* text) {...}
BTW: not an issue but it's better to have: __stdcall int MyDLLFunc2(LPCSTR text){}
Pass string as constant if you don't plan to modify it.
God bless,
Ernest Laurentin
|
|
|
|
|
how do i display a value on top of the screen.
i have a picture box.. and there is a picture on the picture window. now on the picture i need to show a value but this control has to be transparent. how can i achieve that?
i hope its understood..
the background has to be seen. that is the main idea.
|
|
|
|
|
did you try to display the required text on the picture control using its device context?
please try it as follows.
(m_pic.GetDC())->SetBkMode(TRANSPARANT);
(m_pic.GetDC())->TextOut(0,0,"hello");
hope this should work.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
Hi,
wen i try to set a viewport in my dialog,
i m recognizing a diff between the coordinates of
device coordinates and logical units..
how can i map them correctly forfurther drawing purposes..
Gita
|
|
|
|
|
wrote: how can i map them correctly forfurther drawing purposes..
That really depends on how you define "correctly".
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
thanks..
but hope thr s a better mapping modes(formulaes) avail'..
Gita
|
|
|
|