|
Anyone knows how to detect whether or not the current window is console window.
Thanx in advance...
|
|
|
|
|
HWND hwnd = ::GetForegroundWindow();
ASSERT(hwnd != NULL);
TCHAR szClass[256] = _T("");
::GetClassName(hwnd, szClass, 255);
if (_tcsicmp(szClass, _T("ConsoleWindowClass")) == 0)
{
}
else
{
}
I did not compile above code, but you should have got the main idea.
|
|
|
|
|
how do i automatically highlight a row in CListCtrl ?
(i have enabled full row select)
SetSelectionMark doesn't seem to work
|
|
|
|
|
Check out CListCtrl::SetItemState in MSDN.
|
|
|
|
|
I am really new to C++ and I dont have a clue what Im doing yet. I keep reciving the following compiler error
c:\Documents and Settings\Owner\My Documents\Visual Studio Projects\Windows Forms\Form1.h(144): error C2065: 'hInstance' : undeclared identifier The code itself is listed below. If anyone can help me I would apprecaite it very much
<code>
#pragma once
HWND hw;
MSG msg;
int status;
namespace WindowsForms
{
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
public __gc class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
}
protected:
void Dispose(Boolean disposing)
{
if (disposing && components)
{
components->Dispose();
}
__super::Dispose(disposing);
}
private: System::Windows::Forms::Button * button1;
private: System::Windows::Forms::Button * button3;
private: System::Windows::Forms::Button * button4;
private: System::Windows::Forms::TextBox * textBox1;
private:
System::ComponentModel::Container * components;
void InitializeComponent(void)
{
this->button1 = new System::Windows::Forms::Button();
this->button3 = new System::Windows::Forms::Button();
this->button4 = new System::Windows::Forms::Button();
this->textBox1 = new System::Windows::Forms::TextBox();
this->SuspendLayout();
this->button1->Cursor = System::Windows::Forms::Cursors::Hand;
this->button1->ForeColor = System::Drawing::Color::Black;
this->button1->ImageAlign =
System::Drawing::ContentAlignment::TopCenter;
this->button1->Location = System::Drawing::Point(1, 0);
this->button1->Name = S"button1";
this->button1->Size = System::Drawing::Size(208, 38);
this->button1->TabIndex = 0;
this->button1->Text = S"Set Desktop Wallpaper";
this->button1->Click += new System::EventHandler(this, button1_Click);
this->button3->Cursor = System::Windows::Forms::Cursors::Hand;
this->button3->ForeColor = System::Drawing::Color::Black;
this->button3->Location = System::Drawing::Point(1, 38);
this->button3->Name = S"button3";
this->button3->Size = System::Drawing::Size(208, 38);
this->button3->TabIndex = 3;
this->button3->Text = S"Grand Finale";
this->button3->Click += new System::EventHandler(this,
button3_Click_1);
this->button4->ForeColor = System::Drawing::Color::Black;
this->button4->ImageAlign =
System::Drawing::ContentAlignment::BottomCenter;
this->button4->Location = System::Drawing::Point(1, 76);
this->button4->Name = S"button4";
this->button4->Size = System::Drawing::Size(208, 38);
this->button4->TabIndex = 4;
this->button4->Text = S"Exit";
this->button4->Click += new System::EventHandler(this, button4_Click);
this->textBox1->ForeColor = System::Drawing::SystemColors::HotTrack;
this->textBox1->Location = System::Drawing::Point(1, 112);
this->textBox1->Name = S"textBox1";
this->textBox1->ReadOnly = true;
this->textBox1->Size = System::Drawing::Size(208, 20);
this->textBox1->TabIndex = 5;
this->textBox1->Text = S"";
this->textBox1->TextAlign =
System::Windows::Forms::HorizontalAlignment::Center;
this->AutoScaleBaseSize = System::Drawing::Size(5, 13);
this->ClientSize = System::Drawing::Size(210, 136);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->button4);
this->Controls->Add(this->button3);
this->Controls->Add(this->button1);
this->Cursor = System::Windows::Forms::Cursors::No;
this->FormBorderStyle =
System::Windows::Forms::FormBorderStyle::FixedToolWindow;
this->Name = S"Form1";
this->Text = S"A Little Something Just For You";
this->TransparencyKey = System::Drawing::Color::Crimson;
this->Load += new System::EventHandler(this, Form1_Load);
this->ResumeLayout(false);
}
private: System::Void Form1_Load(System::Object * sender, System::EventArgs * e)
{
}
private: System::Void button4_Click(System::Object * sender, System::EventArgs * e)
{
textBox1->Text = S"Your not getting away that easy";
}
private: System::Void button3_Click(System::Object * sender, System::EventArgs * e)
{
BOOL CALLBACK DialogProc (HWND hWnd, UINT uMsg, WPARAM
wParam, LPARAM
lParam);
hw = CreateDialog( hInstance , MAKEINTRESOURCE ( 102 ) ,NULL,
reinterpret_cast<DLGPROC>(DialogProc ));
}
private: System::Void button1_Click(System::Object * sender, System::EventArgs * e)
{
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, (void*)"wallpaper.bmp", SPIF_UPDATEINIFILE |
SPIF_SENDWININICHANGE);
}
private: System::Void button3_Click_1(System::Object * sender, System::EventArgs * e)
{
}
};
}
#include <WinUser.h>
#include "stdafx.h"
#include <windows.h>
#include <stdlib.h>
#include "Form1.h"
using namespace WindowsForms;
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
System::Threading::Thread::CurrentThread->ApartmentState =
System::Threading::ApartmentState::STA;
Application::Run(new Form1());
return 0;
}
</code>
Thanks for any and all help
Draco
|
|
|
|
|
Draco0283 wrote:
#include "Form1.h" // <--- You use hInstance at here in this file.
using namespace WindowsForms;
int APIENTRY _tWinMain(HINSTANCE hInstance, // But hInstance actually is known by the compiler at this line...
HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow){ /* */ }
Maxwell Chen
|
|
|
|
|
Ok in reference to Maxwell Chen I tried several things. I moved the #include "form.h" statement and I tried to move where it calls hInstance. Everything I did brought up more problems than before. Where should it go? Thanks for your help
Draco
|
|
|
|
|
in form1.h you define in the class Form 1 the button3_Click method
System::Void button3_Click(System::Object * sender, System::EventArgs * e) {
BOOL CALLBACK DialogProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
hw = CreateDialog( hInstance , MAKEINTRESOURCE ( 102 ) ,NULL,reinterpret_cast(DialogProc ));
}
This has the parameter sender and e.
Because no parameter hInstance is given as parameter into the method and also there is no class parameter with the name hInstance the parameter hInstance cannot be known to the compiler. Where shall it come from?
In traditional Win32 SDK development this is given to the main function by windows when the application is started and normally will be kept as global variable in the ugly Win32 SDK style. Here you are in the object oriented world of .NET. Possible there are some method in the Form class allowing access to the application object, where one would typically search for the Win32 style instance handle. (I dont know where exactly). It should also work for this case to set NULL instead of the concrete hInstance value of the application.
|
|
|
|
|
Can you give me a suggestion on how to make a amplitude demodulation programming used Visual C++?
Thank you very much!
langzi54
|
|
|
|
|
We're going to need a lot more information to give you a meaningful answer. AM demodulation is trivial - take the absolute value of the sample, or square it and use the positive square root. But what you're trying to accomplish is not at all clear. If you're trying to sample an AM signal directly with a PC, forget it - a PC isn't equipped with anything capable of digitizing and analog signal. If you're dealing with an array or file of sampled, digitized values, there are lots of ways to deal with it. More details about what you are trying to do will result in a far better answer...
Some people think of it as a six-pack; I consider it more of a support group.
|
|
|
|
|
...and it depends the way the samples have been coded (see the codecs)...
|
|
|
|
|
No, it doesn't. Codec operations are performed on baseband signals, before and after modulation/demodulation.
Some people think of it as a six-pack; I consider it more of a support group.
|
|
|
|
|
Hi,
I got a problem in my programmming project.
I need to develop an agent program that connect between server and client.
The matter is I need to develop it in Win 3.1 and MSVC++ 1.52.
So, I chagned some api functions and I could connect sockets between win 2000 server and win 3.1 client.
However, whenever I try to run some functions after accepting socket and checking the IP, agent program makes "Stack Overflow" error.
But no variable initiation is exeist after that.
So, I wanna use Handle for sockets as I did in Win 2000.
Is this the right way?
If so,
Could you please let me know the api function that close handle like CloseHandle in MSVC++ 6.0?
Thanks in advance.
|
|
|
|
|
Why not try to install platform SDK? Probably it could solve the API not exist problem.
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
Life is about reading
This person is trying to use Win3.x, not a Win32 version, so Platform SDK won't help...
Steve S
|
|
|
|
|
When developing socket programs under Win16 the WinSock API (Version 1.1) must be used. (See http://www.sockets.com/winsock.htm[^]).
In short...
You create a socket with the socket() function.
You connect a client socket with the connect(..) function.
You read data from a socket with the recv() function (or if asychron what it a must under Win16 via WSAAsyncSelect and windows messaging on FD_READ)
You close a connected socket with the closesocket() function.
For using this function you must include the winsock.h header. (In the latest MSVC 1.52c version this is included).
A very good book for WinSock Programming under Win16 is named book on the website of the above link: Bob Quinn "Windows Sockets Network Programming"
A pendant for CloseHandle() in Win32 is not known under Win16.
Here you have to handle all socket specific functions with the WinSock API.
|
|
|
|
|
Is it possible for you to post a snippet of code where you get the Stack Overflow?
I don't envy you still developing 16-bit on 1.52. I am glad I no longer need to use this compiler!;)
Ant.
|
|
|
|
|
Please tell me...
How to start another application in my application..
In my application I need to call another application to open. And I am not use the MFC.
Can someone tell me how to open another application.
Thanks..
|
|
|
|
|
ShellExecute would do the trick!
ShellExecute(handle, "open","calc.exe", NULL, NULL,SW_SHOWNORMAL);
/Jarek
As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality.
Albert Einstein
|
|
|
|
|
Also check out CreateProcess() .
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I'm attempting to implement an IP tunneling protocol via TCP/IP on Windows XP platforms. Yeah I know, re-inventing the wheel, but please bear with me. Anyway, the tunneling protocol not only needs to redirect the packets but it needs to modify packet contents and yet be as transparent as possible. The worst part of it all is that I will have to use a pre-compiled DLL to perform certain operations while having no idea how the DLL performs those operations. No, I don't have access to the DLL's code.
I initially thought of implementing it via NDIS drivers, but they run in kernel mode and there isn't any documented way for them to communicate with user-mode processes that I will require to make use of the DLL. There is a way, but it is undocumented which is why I'm shying away from this method.
The other method that I thought of involves creating a tunneling server service coupled with a tunneling client service. The problem here is that I have to intercept IP packets on the client machines and then modify and forward them through the client service. I would also have to add NAT features to the server service. Which I wouldn't have to do using NDIS drivers because they have complete access to the packets before they are sent and I can have Internet Connection Sharing do the NAT work. I was told that it is possible to intercept the IP packets via Windows Sockets but this is unexplored territory for me. I also remember messing with an application running on a Win9x platform which allows the use of a SOCKS proxy for programs which does not include SOCKS support. I suppose the concept is the same, but then again that was Win9x.
I'm more inclined to do the 2nd method since it sounds safer hehe. But I was hoping for a solution that would feel like I'm using the Virtual Private Network implementation built into Windows XP machines. Unfortunately, I simply can't use the MS VPN because of the proprietary design of the protocol I'm supposed to implement.
Right now, I'd be satisfied with information regarding packet interception and modification via Windows Sockets, but I'd be very greatful if someone could come up with a better implementation method.
|
|
|
|
|
How to create dialog to select folder??
|
|
|
|
|
SHBrowseForFolder
modified 12-Sep-18 21:01pm.
|
|
|
|
|
FOr some reason, every time I start my app, the compiler disables my breakpoints, thus I cant debug the way I want.
Any ideas why this is happening?? I'm using VS6.0
-C
|
|
|
|
|
Are you positive that when you built the app you built it in debug mode? I have forgotten that I had built an app in release mode and tried to debug it and received similar results as you have described.
|
|
|
|