|
since this a VC++ forum, you can use your VC++ to create a windows dll and export the dll function.
I am sitting in my flame proof buncker, so don't even bother.
by the way, perl stinks.
|
|
|
|
|
that sounds way over my head in ability I'm afraid.
|
|
|
|
|
you'r going to have to learn....here are a series of beginner tutorials.
I am sitting in my flame proof buncker, so don't even bother.
by the way, perl stinks.
|
|
|
|
|
Hi there,
I have some variable-height controls which need to have some vertically-centered text written on them. My question is: knowing the height the text should occupy, what do I have to do in order to create a point-font?
Thanks a million,
David
|
|
|
|
|
Not really sure what you mean with a point-font, a a font in typographical points? Why not use the height of the control, deduct some margin and create the font with CreateFont using the resulting height?
|
|
|
|
|
Hey there!... and thanks for the reply.
I take it then that there is no way to use the simple BOOL CreatePointFont( int nPointSize, ...) function? I was wondering if there was a way of converting point-size to LP?
David
|
|
|
|
|
Well there is. You get the client CDC , call GetDeviceCaps(LOGPIXELSY) to get the vertical resolution per inch of the output CDC . After this, you divide the result with 72, and gets the height in pixels for a typographical point (you'd obviously have to use double values to do this). Finally, you divide the height of your control with the number of pixels-per-typographical-points calculated, and you're home.
Far easier to just use the height from the beginning
|
|
|
|
|
Ahhh... I see now!
I think that I am going to take your first suggestion -- it is by far better doing so.
You have been very helpful Johan. Thanks a million.
David
|
|
|
|
|
if i have a file(maybe *.asf, *.avi) use MPEG4 or MPEG2 compress.
how to play this file in my execute file~??
|
|
|
|
|
Hello,
The first time I call gethostbyname() in my program, it creates a new thread called "Win32 Thread" in VS.net. Subsequent calls don't create new threads, but the original one never goes away.
This isn't really much of a problem, but if anyone can tell me more about this, please let me know.
Thanks,
Donkey
|
|
|
|
|
Hi
I am writing a project with MFC.
the project has two window's one for logic circuits, and one for state machines. after building the state machin i got a circuit which i have to layout on the circuit view, but i don't understand how to open the circuit window.
the windows are built dynamic, and on new the program asks what kind of window to open.
any help on how to open a new window, or an example that does that will be much appriciated.
10X in advance
sagi
|
|
|
|
|
If you are creating an MDI app, then you need to create a separate view and document for each type of view you wish to display. Use your app class InitInstance function to add the new doc/view to your template. Do some searching at www.msdn.microsoft.com.
I am sitting in my flame proof buncker, so don't even bother.
by the way, perl stinks.
|
|
|
|
|
Here is an out of control bot. Once the ok dialog button is clicked, the bot works ok, but there is no way to interact with the status bar icon. Before ok is clicked, status icon is responsive, but after clicking, there is no answer, and the only way to interrupt the routine is under debug or by ctl-alt-del shutdown of the process.
I've got one of the much-sought-after free G-Mail account to the first person who can find the mistake here.
Here is an outline of the code:
in BotDlg.h
#define WM_TRAY_NOTIFY WM_USER + 0
...
...
class CBotDlg : public CDialog
{
// Construction
public:
CBotDlg(CWnd* pParent = NULL); // standard constructor
LRESULT OnTrayNotify(WPARAM wParam, LPARAM lParam);
void TakeABreak();
void BackToWork();
void OnMenuExit();
NOTIFYICONDATA m_nTrayData;
bool m_bOnBreak;
bool m_bHidden;
...
...
in BotDlg.cpp
...
...
BEGIN_MESSAGE_MAP(CBotDlg, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_MESSAGE (WM_TRAY_NOTIFY, OnTrayNotify)
ON_COMMAND(IDC_BREAK, CBotDlg::TakeABreak)
ON_COMMAND (IDC_WORK, CBotDlg::BackToWork)
ON_COMMAND (IDC_EXIT, CBotDlg::OnMenuExit)
ON_BN_CLICKED(IDOK, OnBnClickedOk)
END_MESSAGE_MAP()
...
...
m_nTrayData.cbSize = sizeof(NOTIFYICONDATA);
m_nTrayData.hWnd = m_hWnd;
m_nTrayData.uID = 0;
m_nTrayData.hIcon = LoadIcon (AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_BREAK));
m_nTrayData.uCallbackMessage = WM_TRAY_NOTIFY;
strcpy (m_nTrayData.szTip, "Bot");
m_nTrayData.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
m_bOnBreak = false;
m_bHidden = false;
return TRUE; // return TRUE unless you set the focus to a control
...
...
// ******************************
// * *
// * Main Process *
// * *
// ******************************
//
// Main Process
//
void CBotDlg::OnBnClickedOk()
{
//go retrieve web pages and follow links
//til no more links
EndDialog(0);
}
// ******************************
// * *
// * OnTrayNotify *
// * *
// ******************************
//
// Tray Notification Handler
//
LRESULT CBotDlg::OnTrayNotify(WPARAM wParam, LPARAM lParam)
{
// ---- Left-button dclick: Exit Program
if (lParam == WM_LBUTTONDBLCLK)
{
Shell_NotifyIcon(NIM_DELETE, &m_nTrayData);
EndDialog(0);
}//end if
// ---- Right-button down: Pop-up menu
if (lParam == WM_RBUTTONDOWN)
{
CMenu menu;
VERIFY (menu.LoadMenu(IDR_MENU1));
CMenu* pPopup = menu.GetSubMenu(0);
ASSERT(pPopup != NULL);
CRect screen;
GetDesktopWindow()->GetWindowRect(screen);
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, screen.right, screen.bottom, AfxGetMainWnd());
}//end if
return LRESULT(0);
}
// ******************************
// * *
// * BackToWork *
// * *
// ******************************
//
// Back to Work Handler
//
void CBotDlg::BackToWork()
{
m_nTrayData.hIcon=LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_WORK));
strcpy (m_nTrayData.szTip, "Bot");
m_nTrayData.uFlags = NIF_ICON | NIF_TIP;
Shell_NotifyIcon (NIM_MODIFY, &m_nTrayData);
}
// ******************************
// * *
// * TakeABreak *
// * *
// ******************************
//
// Take A Break Handler
//
void CBotDlg::TakeABreak()
{
m_nTrayData.hIcon=LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_BREAK));
strcpy (m_nTrayData.szTip, "Bot");
m_nTrayData.uFlags = NIF_ICON | NIF_TIP;
Shell_NotifyIcon (NIM_MODIFY, &m_nTrayData);
}
|
|
|
|
|
I have no use for the "much sought after" GMail account, but perhaps I can solve your problem.
I assume that you are talking about an System Tray area icon that is created and maintained by the program. Now, it seems that after you end the dialog by clicking the Ok-button, you also destroy the dialog window. This window is also marked as the parent of the tray area icon (it's message map has a hander for the tray notification). When the window is destroyed, the tray area icon has no window attached to it, and it will start to behave irrationally.
The way to fix this is to move the adding of the tray area icon INSIDE the dialog's main initialization code (to CDialog::OnInitDialog , for example). Then you should create a supplementary function (call it, for example, CBotDlg::DestroyTrayIcon ). This function is responsible for removing the icon from the tray area.
Now go through your code. Everywhere where you are calling CDialog::EndDialog , you should add a call to CBotDlg::DestroyTrayIcon before the EndDialog call. This makes sure that once the dialog window is destroyed, the tray area icon no longer exists, and can no longer cause irrelevant behaviour.
If your idea is to create and upkeep the tray area icon AFTER the dialog has been destroyed, then you need to create another window that is responsible for handling messages sent by the tray icon. The basic idea is that the tray area icon is always bound to an existing window. If this window gets destroyed with the tray area icon still there, it will lead to unpredictable behaviour.
UPDATE: After reading more of your code sample, it became apparent that your problem is in the dialog window. The tray area icon is bound to the dialog window, but you're destroying the window when EndDialog is called. This leads the tray icon to stop responding. Fixing it is easy: instead of ending the dialog, use ShowWindow to hide the window from sight (minimize to tray), or create a dummy window with no other purpose than to answer to the tray area notifications.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Kitos for the suggestions, but the dialog box doesn't get destroyed until the end of the main routine. The main routine can run for days, that's why I need to interrupt it sometimes. End dialog only happens at the end and then everything appears to terminate normally.
I have experimented with early enddialog and hiding and minimizing the dialog box. You're right, early enddialog leads to unpredictable results. What is also curious and probably related is that when the ok button is clicked, the resulting minimized window also becomes unresponsive, i.e., can't repaint it by clicking on it.
|
|
|
|
|
move ur return LRESULT(0) within the parantheses.It shud work.
|
|
|
|
|
You mean into the prior if statement?
|
|
|
|
|
move the return LRESULT(0) within the brackets.
|
|
|
|
|
The problem is the EndDialog(0) inside your OK button handler. Once EndDialog() is called, the window is destroyed, so any messages that get sent to it are lost, including the ones from the tray icon. Instead of calling EndDialog() , call ShowWindow(SW_HIDE) to merely hide the window without destroying it.
<rant>
Don't you dare offer me a g**** account. If I hear about it one more time I am likely to go insane. Anyone who mentions it should be executed on the spot.
</rant>
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
This solution also makes no changes in the icon behaviour, or anything else.
|
|
|
|
|
void CBotDlg::OnBnClickedOk()
{
//go retrieve web pages and follow links
//til no more links
::Shell_NotifyIcon(NIM_DELETE,&m_nTrayData);
this->EndDialog(0);
}
-----------------------------
"I Think It will Work"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
This solution didn't work. Nothing changed at all not better or worse.
|
|
|
|
|
Hian your code has million of problem,i am emailing you a working applictaion based on your code
-----------------------------
"I Think It will Work"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
typedef FT_STATUS (WINAPI *PtrToOpen)(PVOID, FT_HANDLE *);
PtrToOpen m_pOpen;
FT_STATUS Open(PVOID);
FT_STATUS CBitBangDemoDlg::Open(PVOID pvDevice)
{
if (!m_pOpen)
{
AfxMessageBox("FT_Open is not valid!");
return FT_INVALID_HANDLE;
}
return (*m_pOpen)(pvDevice, &m_ftHandle );
}
Can someone tell me wat this means.And especially wat that WINAPI is.
reeves.
|
|
|
|
|
In WinDef.h you can see that it can be
#define WINAPI CDECL
or
#define WINAPI __stdcall
or
#define WINAPI
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|