|
I used the View to transfer data to and from a struct. This is how I was told to do it but is it bad programming?
|
|
|
|
|
If the data pertains only to the view, such as its size and position then that is ok. If it is related to the underlying document then it should be stored with the document. Can the document be used without this data is a reasonable question to ask.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
MSDN specifically states that OnSysCommand() is called when the user selects a command from the Control (i.e., System) menu, or when the user selects the Maximize or the Minimize button. No mention of the "X" (i.e., Close) button.
So, what is it that you are really wanting to do?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I want to ask the user if they would like to save changes when they click on Close [X]. How do I do that for formviews? There is CanCloseWindow() that gets called when you insert it into the document class. But if I do it that way, I can't figure out which view called it to perform the correct action for that specific view.
|
|
|
|
|
elephantstar wrote:
I want to ask the user if they would like to save changes when they click on Close [X]. How do I do that...
It's done automatically by the document, if you've taken the necessary steps. When the document is modidfied, you simply need to call SetModifiedFlag(TRUE) , and the document will prompt the user to save no matter how the application is shut down.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
hi. . . .
I have a problem in select() function. In the server, this is part of code that handle the setuation of data socket which is checked by select() fn. and it handle closing the client socket "GRACEFULLY OR NUT" so it continue to receive connect()fn. from the client "OR SO I WANT TO DO". but when I do that, the first time the client connect() and closesocket(), it work well. But in the second time the error ((10048: Only one usage of each socket address (protocol/network address/port) is normally permitted)) appeares in the client program. I did not know if the problem from server or the client. This error maybe mean that the socket was not removed from the socket table.
for(sockPos=socketArray.GetStartPosition(); sockPos!=NULL;)
{
socketArray.GetNextAssoc(sockPos,sockArrayKey,(void*&)clientConnection);//CMapStringtoPtr socketArray;
//this is the select(): select(10,&socketReadFD,NULL,&socketErrorFD,&selectTimeout);
//where socketReadFD and socketErrorFD are fd_set type
if(FD_ISSET(clientConnection,&socketReadFD))
{
iRet = recv(clientConnection,msgData,sizeof(msgData), 0);
if(iRet == SOCKET_ERROR)
errorMsgHandler(data->mainHandler, WSAGetLastError());
else if(iRet == 0)
{
//errorMsgHandler(data->mainHandler, WSAGetLastError());
FD_CLR(clientConnection,&mainReadFD);
iRet = closesocket(clientConnection);
if(iRet == SOCKET_ERROR)
errorMsgHandler(data->mainHandler, WSAGetLastError());
socketArray.RemoveKey(sockArrayKey);
}//if close socket from the client Gracefully
else if(iRet >0)
{
CString tmp;
tmp=sockArrayKey;
tmp+=": ";
tmp += msgData;
::PostMessage(data->mainHandler,WM_DATA_MSG,(WPARAM)AllocBuffer(tmp),(LPARAM)AllocBuffer(sockArrayKey));
memset(msgData,'\0',sizeof(msgData));
}//END RECV CONNECTION
}//if FD_ISSET socketReadFD
if(FD_ISSET(clientConnection,&socketErrorFD))
{
errorMsgHandler(data->mainHandler, WSAGetLastError());
FD_CLR(clientConnection,&mainReadFD);
closesocket(clientConnection);
socketArray.RemoveKey(sockArrayKey);
}//if FD_ISSET socketErrorFD
}//sockArray Loop
I wish you to help me in this complex setuation. . .
thanks. . . .
ABO OSAMA
|
|
|
|
|
Hi,
I have problems by adding a Com-Addin to Outlook.
I´m getting this error:
"MyPath" is not a valid Office Add-in
I´ve tried this Microsoft Link:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;235009
but it doesn´t help !
With some PC my Addin works fine, but from others I´ve this error !
(this tells me that my Addin is basically OK !)
What I can I do ?
Need help please !
Thanks a lot, John
|
|
|
|
|
Would it because your Addin only compatible to certain version of Outlook?
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
I have two dialog windows A and B, each has its own toolbar and menubar, B is shown by calling B.DoModal() in A, if i click a menu item in B, it shall hide B and show A again, I used the ShowWindow(SW_HIDE), This is how B is shown after click a menu item in A
//phmd is a global variable defined for an instance of B
// TODO: Add your command handler code here
if (phmd.GetSafeHwnd()==NULL){
phmd.DoModal();
//phmd.SetNetwork(this);
}
else{
phmd.ShowWindow(SW_SHOWNORMAL);
}
then in window B, i call ShowWindow(SW_HIDE) when the menu item A is called.
it hides the window, but the menubar and toolbar is still there and window A is not active even though can display it.
Pls help on this. Thanks a lot!
|
|
|
|
|
You are not supposed to show and hide windows created with DoModal this way. DoModal creates, not surprisingly, a modal> window. Modal windows are displayed until discarded by the user, and during that time, the rest of the application is inactive.
You will rather want modeless windows. Modeless windows are displayed using Create instead of DoModal .
If you need to have B modal, you'll have to either call EndDialog (which kills the dialog), or display A modally from B without hiding it. But Create is probably what you are after.
|
|
|
|
|
I tried the create, however, now the window A can be shown, and is active, however, the menu bar and tool bar is still window B's, does this mean that when I call ShowWindow() function, the menu bar and tool bar is not reloaded?
if so, what shall I do ?
Thanks!
|
|
|
|
|
Hi all,
I have 1 exe and 2 dlls. The exe calls LoadLibrary for the first dll and the first dll calls LoadLibrary for the second dll.
When the first dll calls LoadLibrary for the second dll it fails. GetLastError returns "Invalid Access to Memory Location". Both dlls are Win32 produced with VC6.
I am running on Win2k SP 4.
If I use the .exe to call LoadLibrary for the second dll, it works! But I need it to work from the first dll.
Does anyone have any ideas?
Thanks,
Chris
|
|
|
|
|
Do you load the second DLL from inside DllMain of your first DLL?
According to MSDN it's not safe to do LoadLibrary from DllMain .
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi,
No I am calling LoadLibrary from an exported function of the First Dll. So the main .exe application initiates it when a user clicks a button.
Thanks for trying tho.
Chris
Greeeg wrote:
Do you load the second DLL from inside DllMain of your first DLL?
According to MSDN it's not safe to do LoadLibrary from DllMain.
|
|
|
|
|
Can we see how are you calling it?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Papa wrote:
Can we see how are you calling it?
See below:
void CCopySqlDataLiteDlg::OnTestjdeschemadll()
{
HMODULE handle;
TCHAR* pchPath;
int nReturn;
handle = LoadLibrary(TEXT("JDEDSchemaCache.dll"));
if(handle != NULL)
{
procInit = (JDESCHEMACACHE_INIT) GetProcAddress(handle, TEXT("?Init@@YAHXZ"));
procConnect = (JDESCHEMACACHE_CONNECT) GetProcAddress(handle,
TEXT("?Connect@@YAHPADH@Z"));
pchPath = "C:\\dev\\jdeDirect\\jdedschema\\SQLLite";
nReturn = procInit(); // THIS IS THE EXE CALLING DLL 1
nReturn = procConnect(pchPath, 0);
}
}
JDEDSCHEMACACHE_API int Init() // This is the 1st DLL
{
hModule = NULL;
hModule = LoadLibrary(TEXT("SQLite3.dll")); // Load 2nd DLL Always Fails
return 0;
}
|
|
|
|
|
Are you sure that DllMain isnt throwing any exception?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Papa wrote:
Are you sure that DllMain isnt throwing any exception?
The dll works fine when loaded from the exe! So I dont think there is anything wrong with DllMain. Also the code in DllMain is that provided by VC++ and remains untouched.
Thanks,
Chris
|
|
|
|
|
What happens if both LoadLibrary() calls used absolute, instead of relative, paths?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
DavidCrow wrote:
What happens if both LoadLibrary() calls used absolute, instead of relative, paths?
I still get the same memory error.
Thanks,
Chris
|
|
|
|
|
Chris Ulliott wrote:
hModule = LoadLibrary(TEXT("SQLite3.dll")); // Load 2nd DLL Always Fails
What is the error code when LoadLibrary() fails? I mean, GetLastError()?
126 The specified module could not be found. ERROR_MOD_NOT_FOUND ?
-----------------------------
Get trial copy of comment generating tool CommentMakerPro, std::string and std::string containers viewer FeinEvaluatorPro and windows manager for Microsoft Visual Studio .NET FeinWindows at www.FeinSoftware.com
|
|
|
|
|
vladfein wrote:
Chris Ulliott wrote:
hModule = LoadLibrary(TEXT("SQLite3.dll")); // Load 2nd DLL Always Fails
What is the error code when LoadLibrary() fails? I mean, GetLastError()?
126 The specified module could not be found. ERROR_MOD_NOT_FOUND ?
As mentioned in the initial post, GetLastError returns "Invalid Access to Memory Location". Both dlls are Win32 produced with VC6.
Thanks,
Chris
|
|
|
|
|
is there a way to bind a socket to a network card,the socket is for a client not server.this is because in a multiple card senario i want to choose the card through which i want to direct traffic.
if u cant hack it race it or take it to bed then it aint worth having
|
|
|
|
|
|
Sir,
I am student of Punjab University College of Information Technology, Lahore, Pakistan
I have problem while using Borland C++ v3.1.
Problem:
=========
The size of an object in virtual inheritance increases 2 bytes
Class base
{
public:
int b;
base()
{}
virtual void f() {}
virtual void g() {}
};
Class derive : virtual public base
{
public:
int d;
derive()
{}
virtual void f() {}
virtual void g() {}
};
----------------------
derive d;
cout<<sizeof(d); gives="" 12="" why?
="" *
but="" when="" i="" don’t="" give="" constructor="" in="" derive="" class="" then="" the="" size="" of="" object="" is="" 10,="" because="" there="" will="" be="" no="" 2="" bytes="" extra="" layout.="" please="" help="" me="" out="" about="" finding="" myth="" these="" two="" bytes.
<b="">The object layout in figure is in following URL
OBJECT LAYOUT FIGURE
*/
The object layout where that extra 2 bytes are laid is drawn in atttchment with v-table layout.
Please contact me at!
informfarid@yahoo.com
|
|
|
|