|
Mm... I had to do such a thing before. At that time I did simply create a new control from CWnd...
- NS -
|
|
|
|
|
Hi all.
I have ToolBar and I wont to see it in my dialog.
How I can add this toolbar to my dialog window?
|
|
|
|
|
You will get a lot of samples for this in CP.
see this[^]
- NS -
|
|
|
|
|
|
david bagaturia wrote: How I can add this toolbar to my dialog window?
Use RepositionBars .
|
|
|
|
|
|
Hi,
i created 2 projects. i was able to run the projects sucessfully.
than i replaced the source and header files of one project with newer version.
compilation is sucessfull.
but when i run --LINK : fatal error LNK1104: can't open File 'fskaren.lib' .
where fskaren is one of the project name.
building of fskaren is sucessfull.
please guide me
Help Ever Hurt Never
|
|
|
|
|
sonavi wrote: but when i run --LINK : fatal error LNK1104: can't open File 'fskaren.lib' .
where fskaren is one of the project name.
building of fskaren is sucessfull.
Have you mentioned the library's path in Additional library path.
Goto Project Settings->Link->Input->Additional library path .
|
|
|
|
|
Hello all,
I am having a list control(Report style),in that list control i have number of item. When i select a particular row and click on a button particular thread is started and if i select a different row and press the button same thread is started again.....following the same process i can start any number of same thread.
Now my problem is to end the particular selected thread.
i start thread using this line of code
pThread = (CMyThread*) AfxBeginThread( RUNTIME_CLASS CMyThread),THREAD_PRIORITY_NORMAL,NULL,CREATE_SUSPENDED,NULL);
and when i use this line of code to stop a thread it stops the last thread which is executing...
pThread->PostThreadMessage(WM_QUIT, NULL, NULL);
Can anybody solve my problem
Thanks in advance..
|
|
|
|
|
You need to keep the pThread corresponding to each row in list control. List control allows you to keep a usedefine DWORD value corresponding to each row using the funtion CListCtrl::SetItemData()
Suppose you started a thread for item 1 and you got a pointer pThread of type CWinThread. Keep that pointer in the 1 st row
m_list.SetItemData( 1, (DWORD)pThread);
So when you want to terminate the thread corresponding to the row 1 just use
CWinThread *pThread= (CWinThread*)m_List.GetItemData( 1 );<br />
if( 0 != pThread )<br />
pThread->PostThreadMessage(WM_QUIT, NULL, NULL);
nave
|
|
|
|
|
how to create right button click pop menu for list view control. i have to display a popup menu when the user right clicks the mouse in list view. how to do this. pls help me.
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
|
handle the NM_RCLICK message of the list ctrl. In that function, load the menu and pop it up
void MyDlg::OnRclickList1(NMHDR* pNMHDR, LRESULT* pResult) <br />
{<br />
CMenu PopUpMenu;<br />
PopUpMenu.LoadMenu( IDR_MENU1 );<br />
CPoint pt;<br />
pt = GetCurrentMessage()->pt;<br />
PopUpMenu.GetSubMenu( 0 )->TrackPopupMenu( TPM_LEFTALIGN, pt.x, pt.y, this, 0 );<br />
*pResult = 0;<br />
}
nave
|
|
|
|
|
ok i have to use the options in windows explorer. ie when we rightclick in explorer it popups a menu with view, arrange by icons etc. i have to show like this. whether is there any options to use this directily form windows or we have to create of our own
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
deeps_cute wrote: whether is there any options to use this directily form windows or we have to create of our own
You have to implement it by your self.
deeps_cute wrote: when we rightclick in explorer it popups a menu with view, arrange by icons etc.
When you click on such menu whats actually happing is sorting a column in an order. List control partially help you doing this. Check the LVM_SORTITEMSEX message.
nave
|
|
|
|
|
yes but i have to create the one similar to windows explorer (Mycomputer->Folders). so i thought there will be some fns to use this windows explorer context menu.
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
|
hmm is there any shortcut method to do like the one in windows explorer. pls let me know. i think i am irritating you
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
deeps_cute wrote: pls let me know.
sure..
deeps_cute wrote: i think i am irritating you
no pblm
nave
|
|
|
|
|
Is it possible to dynamically extend an (int) array?
I have an array of x elements, and at run time I want to add additional elements. ie. Array.push()
The only way I can think of would be using memcpy and malloc, but that'd get a bit messy.
Oh, and I'm using Dev C++.
|
|
|
|
|
normal array can not be extend
Your best choice is using Vector (in C++ Standard Template Library - available with all C++ compiler).
Vector allows direct access to elements and also works like a dynamic list.
|
|
|
|
|
yes, vector is good choice, except u wanna write a dynamic array by urself.
life is like a box of chocolate,you never know what you r going to get.
|
|
|
|
|
hi,
I need to create many UI-threads using MFC. Each thread must run all the time and is able to send/receive message with main thread.
I assume that I will have to create a CMyThread:public CWinThread and create many instance of this class in function AfxBeginThread() for UI-thread. But I notice that this function doesn't allow programmer to pass parameters to the newly-created thread.
So, how could I start those threads with different initial parameters ? (e.g pass a client address to each thread sothat each thread serve one client only)
thanks for any help.
|
|
|
|
|
GameProfessor wrote: So, how could I start those threads with different initial parameters ?
Here is one way
1.Add a function to the CMyThread class say "Initialize()"
2.Create the thread in the suspended mode.
3.Call the Initialize() function and pass the parameters that you want to pass.
4.Resume the thread.
nave
|
|
|
|
|
The code won't compile, but I only get some silly messages that don't help. I must be doing something illegal, but I don't have the knowledge of C++ to know what. Does anything catch anyone's eye? This is a basic linked list class that I'm trying to add enumerator functionality to. Project is set to plain unmanaged C++. Thanks in advance...
#pragma once
#include <assert.h>
template <class T>
class LinkedList
{
public:
class Enumerator
{
friend Enumerator LinkedList<T>::GetEnumerator();
public:
virtual T GetCurrent()
{
return _current->Item;
}
virtual bool MoveNext()
{
if (_current == 0)
_current = _linkedList->_head;
else
_current = _current->Next;
return _current != 0;
}
virtual void Reset()
{
_current = 0;
}
protected:
LinkedList<T> *_linkedList;
ListNode *_current;
Enumerator() : _current(0)
{
}
};
LinkedList() : _count(0), _head(0)
{
}
LinkedList(const LinkedList<T> &objectToCopy) : _count(objectToCopy._count)
{
if (objectToCopy._head == 0)
_head = 0;
else
{
_head = new ListNode;
_head->Item = objectToCopy._head->Item;
ListNode *newestNode = _head;
for (ListNode *nodeToCopy = objectToCopy._head->Next; nodeToCopy != 0; nodeToCopy = nodeToCopy->Next)
{
newestNode->Next = new ListNode;
newestNode = newestNode->Next;
newestNode->Item = nodeToCopy->Item;
}
newestNode->Next = 0;
}
}
virtual ~LinkedList()
{
while (_count > 0)
RemoveAt(0);
}
virtual T GetItem(int index)
{
return (AddressOf(index))->Item;
}
virtual int GetCount()
{
return _count;
}
virtual void Add(T value)
{
Insert(_count, value);
}
virtual void Insert(int index, T value)
{
assert(index >= 0 && index <= _count);
ListNode *nodeToInsert = new ListNode;
nodeToInsert->Item = value;
nodeToInsert->Next = AddressOf(index);
if (index == 0)
_head = nodeToInsert;
else
(AddressOf(index - 1))->Next = nodeToInsert;
_count++;
}
virtual void RemoveAt(int index)
{
assert(index >= 0 && index <= _count - 1);
ListNode *nodeToRemove = AddressOf(index);
if (index == 0)
_head = _head->Next;
else
(AddressOf(index - 1))->Next = (AddressOf(index + 1));
_count--;
delete nodeToRemove;
}
virtual Enumerator GetEnumerator()
{
Enumerator newEnumerator;
newEnumerator._linkedList = this;
return newEnumerator;
}
protected:
struct ListNode
{
T Item;
ListNode *Next;
};
int _count;
ListNode *_head;
virtual ListNode *AddressOf(int index)
{
if (index < 0 || index > _count - 1)
return 0;
else
{
ListNode *node = _head;
for (int i = 0; i < index; i++)
node = node->Next;
return node;
}
}
};
|
|
|
|