|
I have a multitreading VC project developed with msvc 6.0
My problem is when I'm running the application in debug mode and some error apears.
The debug pointer stops somewhere in the code written by MS MFC staff and application quits.
I want the debug pointer donot to enter the code written by MS MFC staff,
because I can not determine where is my error cousing line of code.
Seval
|
|
|
|
|
When your program stops, use keypress 'Alt + 7' to bring up the call stack. It will list all the function calls made up to the point of the error. Just go back in the list until you get to your own code.
HTH
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Hi.
i've derived 'CMyListCtrl' from 'ListCtrl'. i've made some functions which allow edit subitems.
On "EditSubLabel" i've made a on-fly editbox where i can type in some text.
But i have the following problem:
I have multiple columns like 'UserID', 'UserName' and 'Birthdate'
The items in userid have to be numeric and 'birthdate' has to be in correct format too.
I know i've got to make a subclass from CEdit (CMyEdit) and overwrite the WM_CHAR message .. but how can i know in 'CMyEdit' which type we are talking about? I think i have to check in the 'CMyListCtrl' class in which column has been clicked and then set a private member of CEdit on a specific value. But that's not good neither .. because then the class will only work for that specific situation .. and i want it too be easily adaptable.
Anyone can help me with this one? (i hope i described my problem enough )
Greetings
Jens
|
|
|
|
|
The iItem and iSubItem members of the LVITEM structure passed in the LVN_BEGINLABELEDIT message to the list control contains the row and column information.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
yes ok
void CMyListCtrl::OnBeginlabeledit(NMHDR* pNMHDR, LRESULT* pResult)
{
LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
LV_ITEM *plvItem = &pDispInfo->item;
*pResult = 0;
}
At the making of the columns, can i set for example (like in visual basic) a tag, an help variabele to detect which type of column we are talking about?
or could you provide me with some working code?
Greetings
Jens
|
|
|
|
|
Hi Jens,
The column number is the iSubItem member. You don't need to tag the columns since all you want is its index.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
To all the experts,
i am writing a application which uses Microsoft Word to print mailing labels.
The Microsoft Knowledge Base Article 278260 "Howto use MFC to Automate word to print Mailing Labels" was a big help so far.
I would really like to give the user of my application a list of available labels to choose from prior to printing. But i can't figure out how to get the list of available labels from word.
This seems to be possible for custom labels by using the CustomLabels - object. However the MailingLabel - object provides no way to get the count or names of the available predefined labels. The only thing you can get is the name of the "last used" label using GetDefaultLabelName(). I even tried to figure out in which file these labelnames are stored to retrieve them from there but without success.
Can anybody help me on how to get this list of available labels out of word?
|
|
|
|
|
I have an dialog based app where the window name can change, however I wish to find the app using FindWindow, so I need to assign a class name to it. I tried to do this using
RegisterWndClass(AfxGetInstanceHandle());
<br />
BOOL CMyDlg::RegisterWndClass(HINSTANCE hInstance)<br />
{<br />
WNDCLASS wc;<br />
wc.lpszClassName = "classTimeNet";<br />
wc.hInstance = hInstance;<br />
wc.lpfnWndProc = ::DefWindowProc;<br />
wc.hCursor = NULL;<br />
wc.hIcon = NULL;<br />
wc.lpszMenuName = NULL;<br />
wc.hbrBackground = (HBRUSH)::GetStockObject(LTGRAY_BRUSH);<br />
wc.style = CS_GLOBALCLASS;<br />
wc.cbClsExtra = 0;<br />
wc.cbWndExtra = 0;<br />
<br />
return (::RegisterClass(&wc) != 0);<br />
}
I then use Spy++ to view the class name, and it hasn't been set.
Does anyone have any ideas please?
I feel like I'm diagonally parked in a parallel universe
Jeremy Davis
http://www.astad.org http://www.jvf.co.uk
|
|
|
|
|
You can not change the class for a dialog box. Instead use #32770 for class name when you call FindWindow
|
|
|
|
|
Drat. I thought of using the 32770 class name, though I may have more than one dialog based app running. I want to FindWindow on a particular app.
Thanks anyway.
I feel like I'm diagonally parked in a parallel universe
Jeremy Davis
http://www.astad.org http://www.jvf.co.uk
|
|
|
|
|
If you have more instances running and you want to find out a window in a specific process then you should use EnumWindows and compare window title, class name and window thread. You can get window's thread with GetWindowThreadProcessId.
|
|
|
|
|
hi,
i want to make a very simpel programm that reads how much sound volume it messured by the microfone. Anyone knows how to do that?
[]D [] []D []
|
|
|
|
|
I am getting an assertion error at file WinCore.cpp at linenumber 312 while subclassing the frame window. This frame window is single document view widows which contain the Rich edit view and document. This Framewindow is in a exe module. I am trying to subclass this window with a class that is declared in a dll and derived from CWnd class.
The dll is a extension dll which is loaded at run time and there is one exportable function “AddplugIn” and class declaration derived form CWnd class.
Here is the code, where the dll is loaded at runtime using AfxLoadLibrary method and the call of the AddPlugIn method.
The address of the main frame window is passed to the dll. The code is as fallows
BOOL CNCStudioUIApp::InitInstance()
{
// Initialize OLE libraries
if (!AfxOleInit())
{
AfxMessageBox(IDP_OLE_INIT_FAILED);
return FALSE;
}
const char* plugin = "NCStudioPluginD.dll";
hPlugin = AfxLoadLibrary(plugin);
if(hPlugin == NULL)
{
MessageBox(“Failed to load the dll”);
Return FALSE;
}
AfxEnableControlContainer();
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// Change the registry key under which our settings are stored.
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CNCStudioUIDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window RUNTIME_CLASS(CNCStudioUIView));
pDocTemplate->SetContainerInfo(IDR_CNTR_INPLACE);
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
CMenu* pMenu = m_pMainWnd->GetMenu();
NCStudio::CNCStudioDLL uiDll;
typedef BOOL (PLUGINPROC)(NCStudio::CNCStudioDLL&);
m_pMainWnd->ShowWindow(SW_SHOW);
uiDll.setMenu(pMenu);
uiDll.setFrameWnd(GetMainWnd());
PLUGINPROC* pFunction = (PLUGINPROC *)GetProcAddress(hPlugin, "AddPlugin");
if(pFunction != NULL)
{
BOOL bSuccess = (*pFunction)(uiDll); //AddPlugin method call
if(bSuccess)
{
m_pMainWnd->DrawMenuBar();
TRACE("Successfully added the plugin");
}
}
// The one and only window has been initialized, so show and update it.
m_pMainWnd->UpdateWindow();
return TRUE;
}
In the dll I am subclassing the frame window the code like this
extern "C"
{ PLUGIN_EXP_IMP BOOL AddPlugin(CNCStudioDLL& ui)
{
//subclassing window
CWnd* pMainWnd = ui.getFrameWnd();
if (!ncPlugIn.SubclassWindow(pMainWnd->GetSafeHwnd()))
// ncPlugIn is the object declared globally in the dll it is the object of a class derived from CWnd. Here I am getting the above assertion error
{
TRACE("Failed to subclass client window\n");
return -1; // fail to create
}
return true
}
Please, Can any body tell me why I am getting this assertion and what is the wrong in my code and tell me how I can avoid it.
|
|
|
|
|
I am not sure whats wrong with your code, but this article of mine Plug-in architecture[^] should support what you are trying to do.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
seems, that nobody can help me
i have 3 main problems, i just cant solve, although they sound easy:
1. I cant change the icon of the addin button.(i always have the default button, a smiley)
(sounds like a easy problem,he? TRY IT!!!,change it to a custom icon!)
2. I cant assign a shortcut, i tried the following but it didnt worked(it compiles, but it does not assign the key)
//in the onconnection method:
SAFEARRAY arrSafe;
arrSafe.fFeatures =FADF_BSTR;
arrSafe.cbElements =35; //maby not necessary
arrSafe.cDims = 1; //maby not necessary
BSTR bstrShortCut =A2BSTR("Global::alt-s");
arrSafe.pvData = bstrShortCut;
VARIANT var1;
var1.vt = VT_ARRAY;
var1.parray = &arrSafe;
pCreatedCommand->put_Bindings(var1);
3. I would like to install my addins(the buttons) by default in a menu next to "Tools" which is called "MyAddins". how can i do this??? (i can manually make a new menu (Tools->customize,etc..) and then install my addin in there automatically (IfFailGoCheck(pCommandBars->get_Item(CComVariant(L"MyAddins"), &pMenuBarCommandBar), pMenuBarCommandBar);
but i cant make this "MyAddins" Menue automatically by code!!
THE FIRST DUDE, WHICH CAN HELP ME IN ANY OF THE 3 ISSUES (ISSUE 2. IS THE EASYEST, I GUESS)
WILL BE NOMINATED FOR THE OFFICAL "ADDIN-MASTER OF THE YEAR AWARD"
|
|
|
|
|
I need to have more than one view in my application
so I have wrote the following function.
void CMyDoc::CreateAllViews()
{
CCreateContext l_Context;
l_Context.m_pCurrentDoc = this;
CView* l_pActiveView = g_pMainFrame->GetActiveView();
::SetWindowLong(l_pActiveView->m_hWnd, GWL_ID, 0);
l_Context.m_pNewViewClass = RUNTIME_CLASS(CRilevamentoDatiView);
m_pRilevamentoDatiView = (CRilevamentoDatiView*)STATIC_DOWNCAST(CView, g_pMainFrame->CreateView(&l_Context));
l_Context.m_pNewViewClass = RUNTIME_CLASS(CStatisticheView);
m_pStatisticheView = (CStatisticheView*)STATIC_DOWNCAST(CView, g_pMainFrame->CreateView(&l_Context));
l_Context.m_pNewViewClass = RUNTIME_CLASS(CFiltriView);
m_pFiltriView = (CFiltriView*)STATIC_DOWNCAST(CView, g_pMainFrame->CreateView(&l_Context));
l_Context.m_pNewViewClass = RUNTIME_CLASS(CConfigurazioneView);
m_pConfigurazioneView = (CConfigurazioneView*)STATIC_DOWNCAST(CView, g_pMainFrame->CreateView(&l_Context));
}
The problem is the following:
views creation is ok but all of them looks like the last one created
in my function.
Is it possible to have multiple views in a SDI project ??
Does someone knows why my function doesn't works ???
|
|
|
|
|
Just have a look on this website...
|
|
|
|
|
I need to have more than one view in my SDI project.
I'd prefer to don't create a new view and destroy the old one
any time I have to change view.
I'd prefer to create all my views at the creation of the application
and to manage them into an array (statically).
Is it possible to do that ???
I have wrote this function:
void CMyDoc::CreateAllViews()
{
CCreateContext l_Context;
l_Context.m_pCurrentDoc = this;
CView* l_pActiveView = g_pMainFrame->GetActiveView();
::SetWindowLong(l_pActiveView->m_hWnd, GWL_ID, 0);
l_Context.m_pNewViewClass = RUNTIME_CLASS(CRilevamentoDatiView);
m_pRilevamentoDatiView = (CRilevamentoDatiView*)STATIC_DOWNCAST(CView, g_pMainFrame->CreateView(&l_Context));
l_Context.m_pNewViewClass = RUNTIME_CLASS(CStatisticheView);
m_pStatisticheView = (CStatisticheView*)STATIC_DOWNCAST(CView, g_pMainFrame->CreateView(&l_Context));
l_Context.m_pNewViewClass = RUNTIME_CLASS(CFiltriView);
m_pFiltriView = (CFiltriView*)STATIC_DOWNCAST(CView, g_pMainFrame->CreateView(&l_Context));
l_Context.m_pNewViewClass = RUNTIME_CLASS(CConfigurazioneView);
m_pConfigurazioneView = (CConfigurazioneView*)STATIC_DOWNCAST(CView, g_pMainFrame->CreateView(&l_Context));
l_Context.m_pNewViewClass = RUNTIME_CLASS(CDatiAnamnesticiView);
m_pDatiAnamnesticiView = (CDatiAnamnesticiView*)STATIC_DOWNCAST(CView, g_pMainFrame->CreateView(&l_Context));
l_Context.m_pNewViewClass = RUNTIME_CLASS(CModInterazioneView);
m_pModInterazioneView = (CModInterazioneView*)STATIC_DOWNCAST(CView, g_pMainFrame->CreateView(&l_Context));
}
But It doesn't work... views creation ends with success but when I try
to show a view it looks like the last view created by my function...
All views created by my function, lokks like the last one created !!!
Does someone knows which is the problem ??? Or can supply me any other
information in order to have multiple views in my project ???
Thanks a lot
|
|
|
|
|
How To Detect Proxy Settings and Manipulate them for Internet connection ?.
I am using Sockets For communication between PC's
|
|
|
|
|
For IE, use InternetQueryOption and InternetSetOption , but be aware proxy settings don't have any effect on your sockets (maybe you're mixing proxies and gateways?)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Sir, can you tell me why the following code not works in VC++ 7.0
std::hash_set<std::string> myhash;<br />
myhash.insert("string");
Strange that it works if we use std::set instead of std::hash_set
|
|
|
|
|
In which sense doesn't it work? Compiler error, crash at run-time? With some more info maybe I can be more helpful.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Dear Joaquín i require little help. The question is related to std::set
I am doing something like this:
std::hash_set<std::string> myset;<br />
std::string country="india";<br />
<br />
myset.insert(country);
But the code above is not working on my VC++ 7.0 compiler. I am getting an error. I am copying below:
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\xhash(38): error C2440: 'type cast' : cannot convert from 'const std::string' to 'size_t'
|
|
|
|
|
Are you sure you've inserted the appropriate #include <string> ? Other than that, I cannot figure out how such a simple piece of code is causing the compiler to go awry.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Sorry, actually the code above is working, but if i use std::hash_set instead of std::set , it does not work. I am writing code below:
using namespace std;
int main(int argc, char* argv[])
{
string name = "india";
hash_set<string> val;
val.insert(name);
return 0;
}
The error i am getting is:
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\xhash(38): error C2440: 'type cast' : cannot convert from 'const std::string' to 'size_t'
Yes i am including all the required headers.
|
|
|
|