|
WOW! That's some bug...
Hmm, lets see... if after this "change" occurs once and you cannot access your members properly thereafter, it could mean some copy function is playing foul and overwriting its buffer,...
but, if you can access your members correctly "now-and-then", well... all I can think of... is a pointer-to-view pointing to the wrong place...
Clinton
|
|
|
|
|
Hi Guys
I have a problem(why else should i post here?). I only now the executable's name and it is sure that it is running. How can i get the HWND by just knowing the name of the file ?
Please Help !!
MFG
RedDragon2kx
Unix and C are the ultimate computer viruses.
|
|
|
|
|
Hi,
You can use the SPY++ Utility which comes with Visual Studio Tools
Sujan
|
|
|
|
|
RedDragon2k wrote:
have a problem(why else should i post here?). I only now the executable's name and it is sure that it is running. How can i get the HWND by just knowing the name of the file ?
Here Are the apis that will help you Out
->GetModuleHandle
->GetModuleHandleEx
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Thanks a lot !!! ;)
Unix and C are the ultimate computer viruses.
Visit me: www.programming.info.ms
|
|
|
|
|
WinDbg and Microsoft support believe there is a memory leak in this function. I don't see it, but I'm not a guru. Can you see it?
void CClientSession::WriteTableListGetQueryListRS(
BOOL bDetails,
CString strTable,
enum eTable tableSave,
BOOL & bDeniedAccess,
BOOL & bDeniedAccessOther,
CStringArray & arrFields,
CArray<long, long=""> & arrLookups,
long & lLookup,
long & lPrimarySortField,
CString & strPrimarySortField,
CString & strPrimarySortOrder,
CString & strFields,
CString & strJoin,
CString & strWhere,
CString & strSQL)
{
CString strField;
CString strListFields;
CString strOrderBy;
TRY
{
if (bDetails && !m_pExt->GetServerPtr()->GetDeptView(strTable, m_lDeptID))
return NULL;
bDeniedAccess = m_pExt->GetServerPtr()->GetTableAccess(strTable, FALSE,
m_stateCurrent.m_strMainTable, m_stateCurrent.m_lMainRecord,
m_stateCurrent.m_strDepTable, m_stateCurrent.m_lDepRecord,
m_lDeptID, m_lCompanyID);
if (GetFunc() == CMD_SUMMARY)
bDeniedAccessOther = m_pExt->GetServerPtr()->GetTableAccess(strTable, FALSE,
m_stateCurrent.m_strMainTable, m_stateCurrent.m_lMainRecord,
"", -1, m_lDeptID, m_lCompanyID);
else if (bDeniedAccess)
return NULL;
if (bDeniedAccessOther)
return NULL;
// strFields i.e.: Person.Last_Name, Statuses.Company_ID, etc.
int nFind = strPrimarySortField.Find('.');
strPrimarySortField = strPrimarySortField.Mid(nFind + 1);
if (m_pExt->GetServerPtr()->GetDependencyCount(m_stateCurrent.m_strMainTable))
m_stateCurrent.m_strDepTable = m_pExt->GetServerPtr()->GetDependency(m_stateCurrent.m_strMainTable, 0);
if (!bDetails)
{
if (strTable == m_stateCurrent.m_strMainTable && !m_stateCurrent.m_strDepTable.IsEmpty())
{
if (strJoin.Find(" LEFT OUTER JOIN " + m_stateCurrent.m_strDepTable) == -1)
{
strJoin = " LEFT OUTER JOIN " + m_stateCurrent.m_strDepTable + " ON " + m_stateCurrent.m_strDepTable + "." + m_stateCurrent.m_strMainTable + "_ID=" + m_stateCurrent.m_strMainTable + ".ID" + strJoin;
strFields = m_stateCurrent.m_strDepTable + ".ID," + strFields;
}
}
else if (m_stateCurrent.m_eTable == Sub)
{
strJoin = " INNER JOIN Statuses ON Statuses.ID = " + strTable + ".Person_IDS";
}
//Add to SELECT fields
strFields = "," + strFields + GetSQLFields(strTable);
// Search Fields
if (GetFunc() == CMD_SEARCH)
{
CString strSearchField;
if (!GetCookie(GetTable() + ".SearchText").IsEmpty())
{
strSearchField = GetCookie(m_stateCurrent.m_strMainTable + ".SearchField");
if (strFields.Find("," + strSearchField + ",") == -1)
if (strFields.Find(strSearchField, strFields.GetLength() - strSearchField.GetLength()) == -1)
strFields += "," + strSearchField;
}
if (!GetCookie(GetTable() + ".SearchText2").IsEmpty())
{
strSearchField = GetCookie(m_stateCurrent.m_strMainTable + ".SearchField2");
if (strFields.Find("," + strSearchField + ",") == -1)
if (strFields.Find(strSearchField, strFields.GetLength() - strSearchField.GetLength()) == -1)
strFields += "," + strSearchField;
}
strSearchField.Empty();
}
//Build Sort Order
CString strColumn;
for(int nColumn = 0 ; nColumn < 3 ; nColumn++)
{
strColumn.Format("%s.Sort%d", strTable, nColumn);
strColumn = GetCookie(strColumn);
nFind = strColumn.Find('.');
if (nFind != -1)
strColumn = strColumn.Mid(nFind + 1);
if (!strColumn.IsEmpty())
if (strOrderBy.Find(strColumn) == -1)
AddSortColumn(strTable, strColumn, strOrderBy);
}
//Build Sort Order part 2
if (strOrderBy.IsEmpty())
{
CString strOrder = m_pExt->GetServerPtr()->GetDefaultOrderBy(strTable) + ",";
CString strSort;
nFind = strOrder.FindOneOf(", ");
nColumn = 0;
while (nFind != -1)
{
strOrderBy += strTable + "." + strOrder.Left(nFind);
if (strOrder[nFind] == ' ')
nFind = strOrder.Find(',');
strOrder = strOrder.Mid(nFind + 1);
nFind = strOrder.FindOneOf(", ");
if (nFind != -1)
strOrderBy += ',';
}
strOrder.Empty();
strSort.Empty();
}
CString strTableField;
strFields += ",";
strFields = strFields.Mid(1);
int nDot;
long lField = 0;
/*
strListFields
*/
nFind = strFields.Find(',');
while (nFind != -1)
{
strTableField = strFields.Left(nFind);
nDot = strTableField.Find('.');
if (nDot != -1)
{
strField = strTableField.Mid(nDot + 1);
strTableField.ReleaseBuffer(nDot);
}
else
{
strField = strTableField;
strTableField = strTable;
}
strFields = strFields.Mid(nFind + 1);
lLookup = m_pExt->GetServerPtr()->GetLookup(strTableField, strField);
arrLookups.Add(lLookup);
arrFields.Add(strField);
strTableField = AddFieldSQL(lLookup, lField, strJoin, strWhere, strOrderBy);
//Only display columns that aren't set to hidden in TableFields.Dept_Visible
if (m_pExt->GetServerPtr()->GetLookupHiddenView(lLookup, m_lDeptID) == FALSE)
{
if (!strListFields.IsEmpty())
strListFields += ",";
strListFields += strTableField;
}
if (lPrimarySortField == -1
&& m_pExt->GetServerPtr()->GetLookupTable(lLookup) + "." + strField == strPrimarySortField)
{
lPrimarySortField = lField;
strPrimarySortField = strTableField;
}
lField++;
nFind = strFields.Find(',');
}
strColumn.Empty();
strTableField.Empty();
}
else
strListFields = "COUNT(ID)";
strSQL = "SELECT " + strListFields + " FROM " + strTable + strJoin + strWhere;
if (!strOrderBy.IsEmpty())
strSQL += " ORDER BY " + strOrderBy;
OutputDebugString(strSQL + "\r\n");
}
CATCH_ALL(e)
{
DumpError(e, __FILE__, __LINE__);
m_stateCurrent.m_eTable = tableSave;
return NULL;
}
END_CATCH_ALL
WriteResponseDebug(strSQL);
strSQL.Empty();
strField.Empty();
strListFields.Empty();
strOrderBy.Empty();
}
<signature>
It's good to live,
Josef Wainz
Software Developer
|
|
|
|
|
Is is possible to convert an existing application(MFC) into an activex control so that it can be embedded into internet explorer. If so how can i can go about it?
Thanks
|
|
|
|
|
create an activex project and implement every function in the exe in to that ocx ,
Ninety-eight percent of the thrill comes from knowing that the thing you designed works, and works almost the way you expected it would. If that happens, part of you is in that machine.
|
|
|
|
|
Dear all,
I used a truecolor icon for my application. Unfortunately, Win NT does not support truecolor icon. How can I change the icon to a 256-color one (in run-time) when it runs in Win NT4?
Best regards,
|
|
|
|
|
|
Thanks Anders,
It worked!!
BRs.
|
|
|
|
|
I just converted to VS7 and had to change some things around.
My good old #include <fsream.h> did not work anymore, so I converted to CStdioFile.
the problem is that now, the "\n" is not being printed out to the file, even though the microsoft site claims WriteString shoud do it.
Here is my code:
<br />
CStdioFile log_file (_T(file.txt"),CFile::modeWrite | CFile::modeCreate | CFile::typeText);<br />
<br />
CString h="Hello\nThere";<br />
log_file.WriteString (h);<br />
<br />
The expected output is:
Hello
There
But I get:
HelloThere
|
|
|
|
|
I think you get the output that way 'cos the file was opened in typeText.
I'd be interested to know if it worked with
"Hello\r\nThere".
Clinton
|
|
|
|
|
Are there example on DrawDragRect?
I need one specific dealing when the object is drag outside the window.
Case 1: Assume L mouse click is release when it's outside the window
Case 2: Don't assume mouse is release. Check mouse status when it reenters the window.
The other thing I would like to do is change mouse icon if it's drag outside the window range with L mouse click still down.
Thanks
|
|
|
|
|
|
The following code works but not like the examples I have reviewed on this site. Please provide comments on improving and/or explanations on comments. The OnClose() function in my class is getting the WM_CLOSE message before my DoModal loop sees it.
The CRpt class is used in a generic class and therefore is not a child of the main window. I may also want to create a CRpt in a console application, therefore I need a message loop or the CRpt window opens and immediately closes.
Any help would be appreciated.
Class CRpt : public CWnd
{
...
public:
int DoModal(HWND parent=NULL);
bool isClosed; // set to false in constructor, set to true in OnClose
...
}
int CRpt::DoModal(HWND parent)
{
//ASSERT(::IsWindow(m_hWnd));
//parent = AfxGetMainWnd()->GetSafeHwnd(); 'from calling procedure'
ShowWindow(SW_RESTORE);
if(parent!=NULL) ::EnableWindow(parent, FALSE);
for(bool finished = false; !finished && !isClosed; WaitMessage()) {
MSG msg;
while(PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) {
if(msg.message==WM_QUIT) {
AfxMessageBox("WM_QUIT"); // <--never gets here
finished = true;
::PostMessage(NULL, WM_QUIT, 0, 0); //PostMessage(WM_QUIT, 0, 0);
break;
}
if(!isClosed) { // <--set to true in OnClose(); needed or i get assert on next line!?!
if(!IsDialogMessage(&msg)) { //::IsDialogMessage(m_hWnd, &msg)
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
} else {
finished = true;
break;
}
}
}
//AfxMessageBox("Exiting DoModal");
if(parent!=NULL) {
::EnableWindow(parent, TRUE);
//::ShowWindow(parent, SW_SHOWNORMAL); // <--not working!?!
::ShowWindow(parent, SW_MINIMIZE); // <--needed or SW_RESTORE doesn't work!?!
::ShowWindow(parent, SW_RESTORE);
}
//DestroyWindow(); // called in OnClose()
return 0;
}
|
|
|
|
|
are there any "known' caveats when using _malloc_dbg ?
do I have to use the _free_dbg ?
from the small tests I did, seems I can use _malloc_dbg and simply use free.
Thanks.
M.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
the docs on msdn say that you must use _free_dbg.
Thank You
Bo Hunter
|
|
|
|
|
|
peterchen wrote:
guard bytes,
Sir,If you don't Midn please tell me What is Guard bytes
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
No need for the Sir, Sir
malloc_dbg calls malloc, but requests a few more bytes. These bytes are filled with a predefined value. free_dbg then checks if these extra bytes still hold this value. If they did, you probably wrote beyond the allocated memory (The VC Runtime prints a diagnostic message to the debug output)
Typical implementations add 4 bytes at the end. In this case, using free instead of _free_dbg is often not a problem, but depending on the implementation, it might leak the guard bytes.
But if an implementation adds guard bytes *before* the memory provided to you (to detect underflows, which are less common), using free instead of -free_dbg is likely to corrupt the heap.
we are here to help each other get through this thing, whatever it is Vonnegut jr. boost your code || Fold With Us! || sighist | doxygen
|
|
|
|
|
Yeah Right,
I understand _malloc_dbg and _free_dbg thanks.
About
peterchen wrote:
Sir
That a way to Show Respect to Elder.
Thanks Again Sir!!!
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Hi
Can someone tell me how to program an alt+tab replacement similar to the one microsoft uses in the powertoys?
Capturing Alt+Tab probably won't be the problem, but how to I replace the dialog in the center of the screen with my own?
See http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Here is an article that demonstrates XP Visual styles but also has examples of the code you are looking for...
ALT-TAB enhanced with XP styles[^]
Alex Korchemniy
|
|
|
|
|
That's great, thanks a lot!
modified 12-Sep-18 21:01pm.
|
|
|
|
|